Bagaimana cara indentasi kata kunci selaras?

17

Mungkin dipengaruhi oleh Clojure, saya lebih sering menggunakan daftar properti sebagai struktur data. Emacs sebagian besar waktu indentasi mereka seperti ini,

`(:token ,token
         :token-quality ,quality)  , 

sementara ini yang saya inginkan

`(:token ,token
  :token-quality ,quality) . 

Jadi, saya bertanya-tanya, apakah seseorang sudah menangani ini?

politza
sumber
3
Perilaku item daftar adalah hardcode, jadi Anda harus mengganti fungsi seperti yang ditunjukkan di sini .
wasamasa
Terima kasih banyak. Tapi mengapa mendefinisikannya kembali, jika ada variabel untuk itu?
politza
@wasamasa Saya pikir saya mungkin beralih ke itu .. cukup ganti nama fungsi itu Fuco1/lisp-indent-functiondan lakukan(add-hook 'emacs-lisp-mode-hook (lambda () (setq-local lisp-indent-function #'Fuco1/lisp-indent-function)))
Kaushal Modi

Jawaban:

4

Itu dapat dicapai dengan mengubah lisp-indent-functionmode for emacs-lisp:

(add-hook 'emacs-lisp-mode-hook
          (lambda () (setq-local lisp-indent-function #'common-lisp-indent-function)))

Dari lisp-mode.eldalam sumber emacs,

 (defcustom lisp-indent-function 'lisp-indent-function
  "A function to be called by `calculate-lisp-indent'.
It indents the arguments of a Lisp function call.  This function
should accept two arguments: the indent-point, and the
`parse-partial-sexp' state at that position.  One option for this
function is `common-lisp-indent-function'."
  :type 'function
  :group 'lisp)

Alternatif

Seperti @wasamasa disebutkan dalam komentar untuk pertanyaan, @ Fuco1 (di github.com) telah memodifikasi defaultlisp-indent-function untuk memperbaiki indentasi kata kunci (dimulai dengan :).

Emacs telah menyediakan variabel lisp-indent-functionbagi pengguna untuk memilih fungsi apa yang akan digunakan untuk indentasi dalam mode lisp.

Alih-alih menimpa definisi fungsi asli, kita dapat membuat fungsi kita sendiri dan menetapkan variabel di atas untuk nama fungsi tersebut.

Dalam contoh ini,

  • Simpan fungsi modded Fuco1 sebagai sesuatu seperti Fuco1/lisp-indent-functiondi pengaturan emacs Anda
  • Manfaatkan fungsi itu untuk lekukan di emacs-lisp-mode:
(add-hook 'emacs-lisp-mode-hook
          (lambda () (setq-local lisp-indent-function #'Fuco1/lisp-indent-function)))

Referensi

Fungsi modded disisipkan di bawah jika sumber yang dirujuk ke github hilang.

;; https://github.com/Fuco1/.emacs.d/blob/af82072196564fa57726bdbabf97f1d35c43b7f7/site-lisp/redef.el#L20-L94
(defun Fuco1/lisp-indent-function (indent-point state)
  "This function is the normal value of the variable `lisp-indent-function'.
The function `calculate-lisp-indent' calls this to determine
if the arguments of a Lisp function call should be indented specially.

INDENT-POINT is the position at which the line being indented begins.
Point is located at the point to indent under (for default indentation);
STATE is the `parse-partial-sexp' state for that position.

If the current line is in a call to a Lisp function that has a non-nil
property `lisp-indent-function' (or the deprecated `lisp-indent-hook'),
it specifies how to indent.  The property value can be:

* `defun', meaning indent `defun'-style
  \(this is also the case if there is no property and the function
  has a name that begins with \"def\", and three or more arguments);

* an integer N, meaning indent the first N arguments specially
  (like ordinary function arguments), and then indent any further
  arguments like a body;

* a function to call that returns the indentation (or nil).
  `lisp-indent-function' calls this function with the same two arguments
  that it itself received.

This function returns either the indentation to use, or nil if the
Lisp function does not specify a special indentation."
  (let ((normal-indent (current-column))
        (orig-point (point)))
    (goto-char (1+ (elt state 1)))
    (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
    (cond
     ;; car of form doesn't seem to be a symbol, or is a keyword
     ((and (elt state 2)
           (or (not (looking-at "\\sw\\|\\s_"))
               (looking-at ":")))
      (if (not (> (save-excursion (forward-line 1) (point))
                  calculate-lisp-indent-last-sexp))
          (progn (goto-char calculate-lisp-indent-last-sexp)
                 (beginning-of-line)
                 (parse-partial-sexp (point)
                                     calculate-lisp-indent-last-sexp 0 t)))
      ;; Indent under the list or under the first sexp on the same
      ;; line as calculate-lisp-indent-last-sexp.  Note that first
      ;; thing on that line has to be complete sexp since we are
      ;; inside the innermost containing sexp.
      (backward-prefix-chars)
      (current-column))
     ((and (save-excursion
             (goto-char indent-point)
             (skip-syntax-forward " ")
             (not (looking-at ":")))
           (save-excursion
             (goto-char orig-point)
             (looking-at ":")))
      (save-excursion
        (goto-char (+ 2 (elt state 1)))
        (current-column)))
     (t
      (let ((function (buffer-substring (point)
                                        (progn (forward-sexp 1) (point))))
            method)
        (setq method (or (function-get (intern-soft function)
                                       'lisp-indent-function)
                         (get (intern-soft function) 'lisp-indent-hook)))
        (cond ((or (eq method 'defun)
                   (and (null method)
                        (> (length function) 3)
                        (string-match "\\`def" function)))
               (lisp-indent-defform state indent-point))
              ((integerp method)
               (lisp-indent-specform method state
                                     indent-point normal-indent))
              (method
               (funcall method indent-point state))))))))
Kaushal Modi
sumber
Bukankah agak ekstrim untuk mengubah fungsi indentasi lengkap dengan itu untuk bahasa lain? Saya Guile Saya memiliki masalah yang sama di mana kata kunci #: tidak selaras dengan cara yang saya harapkan, namun saya tidak akan mengganti fungsi indentasi Guile dengan yang dibuat untuk Common Lisp.
rekado
1
@ Kunado saya setuju. Tetapi ini tampaknya menjadi kasus khusus. Saya menghadapi iritasi yang sama dari kata kunci yang tidak selaras (dalam definisi hydra) dan sedang mencari solusi di luar sana. Saya akhirnya mencoba saran ini dari emacswiki dan itu telah menjadi bagian dari konfigurasi emacs saya selama sekitar satu bulan sekarang. Saya juga ingin melihat penerapan yang bersih untuk menyelaraskan kata kunci di lisp-indent-function.
Kaushal Modi
Menarik ... Ini juga perlu (setq lisp-backquote-indentation nil)daftar backquoted (seperti dalam pertanyaan asli).
politza
@politza Maaf, terburu-buru saya salah membaca backquotes sebagai sintaks untuk memformat teks sebagai blok kode dalam penurunan harga.
Kaushal Modi
2

Intro untuk menghitung indentasi-lisp

Solusi yang lebih baik adalah mengganti fungsi calculate-lisp-indent. Singkatnya, calculate-lisp-indentadalah fungsi yang mengembalikan kolom yang barisnya harus di indentasi. Fungsi ini yang menginformasikan lisp-indent-functionberapa banyak setiap baris harus diindentasi. (lihat juga posting saya di reddit untuk informasi lebih lanjut).

Perbandingan dengan Jawaban lain

Keuntungan dari jawaban ini dibandingkan dengan menggunakan fungsi Fuco1 yang dimodifikasi adalah bahwa (1) memperbaiki akar masalah yang terletak pada calculate-lisp-indentbukan hanya membersihkan setelah lekukan yang salah dikembalikan oleh calculate-lisp-indent(2) ia menggeneralisasi untuk mengutip dan mengutip kembali daftar (dan itu berfungsi baik mereka dikutip / dikutip ulang secara eksplisit atau dengan 'dan `). Ini juga bekerja dengan kutipan dan backquotes yang disarang secara sewenang-wenang.

Keuntungan dari jawaban ini dibandingkan lisp-indent-functiondengan common-lisp-indent-functionfungsinya adalah tidak memiliki efek samping mengacaukan lekukan lain. Elisp dan common-lisp dibuat indentasi berbeda.

Bagaimana itu bekerja

Bersyarat (dalam hal ini calculate-lisp-indent) adalah apa yang memutuskan apakah sexp sebuah menjorok seperti fungsi atau tidak. Apa yang termasuk dalam klausa lain adalah lekukan seperti fungsi. Apa yang termasuk dalam klausa ini adalah indentasi normal (di bawah elemen saat ini). Untuk menjadikannya indentasi daftar yang dikutip sebagai data alih-alih sebagai fungsi, kita perlu menambahkan lebih banyak pemeriksaan untuk kasus-kasus di mana daftar tersebut dikutip dalam predikat bersyarat.

(if (= (point) calculate-lisp-indent-last-sexp)
    ;; Containing sexp has nothing before this line
    ;; except the first element.  Indent under that element.
    nil
  ;; Skip the first element, find start of second (the first
  ;; argument of the function call) and indent under.
  (progn (forward-sexp 1)
         (parse-partial-sexp (point)
                             calculate-lisp-indent-last-sexp
                             0 t)))

Kode ini memeriksa tanda kurung terbuka dari sexp yang sedang indentasi. Jika sexp dengan multiple sexp memeriksa semuanya. Ini mengembalikan t jika ia menemukan sexps yang dikutip atau dikutip kembali.

(let* ((positions (elt state 9))
       (last (car (last positions)))
       (rest (nreverse (butlast positions)))
       (any-quoted-p nil)
       (point nil))
  (or
   (when-let (char last)
     (or (char-equal char ?')
         (char-equal char ?`)))
   (while (and rest (not any-quoted-p))
     (setq point (pop rest))
     (setq any-quoted-p
           (or
            (when-let (char point)
              (or (char-equal char ?')
                  (char-equal char ?`)))
            (save-excursion
              (goto-char (1+ point))
              (looking-at-p "\\(?:back\\)?quote[\t\n\f\s]+(")))))))

Bonus

Jika Anda ingin daftar yang dimulai dengan kata kunci diindentasi sebagai data meskipun tidak dikutip, tambahkan ini sebagai cek lain ke predikat bersyarat. Ini mungkin berguna untuk makro di mana daftar tidak dikutip untuk kenyamanan seperti di defhydra .

(when-let (char-after (char-after (1+ containing-sexp)))
  (char-equal char-after ?:))

Contohnya

Cuplikan kode lengkap yang saya poskan di bawah berfungsi dengan case yang Anda sebutkan dan banyak lagi. Silakan dicoba!


;; Your example
`(:token ,token
  :token-quality ,quality)

;; Other cool examples
(quote (hi im gosu
        the best vayne player))

'(i am the phantom of
  the opera)

'((angel of music
   hide no longer))

(backquote (past the point
            no return
            ... the final chapter))

`(fee fi fo
  fum)

;; should indent it like a function.
(iamafunction arg1
              arg2
              arg3)

Untuk penjelasan yang lebih mendalam tentang cara kerjanya, lihat posting saya di reddit .

Cuplikan Kode Lengkap

Berikut ini cuplikan kode lengkap.

(advice-add #'calculate-lisp-indent :override #'void~calculate-lisp-indent)

(defun void~calculate-lisp-indent (&optional parse-start)
  "Add better indentation for quoted and backquoted lists."
  ;; This line because `calculate-lisp-indent-last-sexp` was defined with `defvar` 
  ;; with it's value ommited, marking it special and only defining it locally. So  
  ;; if you don't have this, you'll get a void variable error.
  (defvar calculate-lisp-indent-last-sexp)
  (save-excursion
    (beginning-of-line)
    (let ((indent-point (point))
          state
          ;; setting this to a number inhibits calling hook
          (desired-indent nil)
          (retry t)
          calculate-lisp-indent-last-sexp containing-sexp)
      (cond ((or (markerp parse-start) (integerp parse-start))
             (goto-char parse-start))
            ((null parse-start) (beginning-of-defun))
            (t (setq state parse-start)))
      (unless state
        ;; Find outermost containing sexp
        (while (< (point) indent-point)
          (setq state (parse-partial-sexp (point) indent-point 0))))
      ;; Find innermost containing sexp
      (while (and retry
                  state
                  (> (elt state 0) 0))
        (setq retry nil)
        (setq calculate-lisp-indent-last-sexp (elt state 2))
        (setq containing-sexp (elt state 1))
        ;; Position following last unclosed open.
        (goto-char (1+ containing-sexp))
        ;; Is there a complete sexp since then?
        (if (and calculate-lisp-indent-last-sexp
                 (> calculate-lisp-indent-last-sexp (point)))
            ;; Yes, but is there a containing sexp after that?
            (let ((peek (parse-partial-sexp calculate-lisp-indent-last-sexp
                                            indent-point 0)))
              (if (setq retry (car (cdr peek))) (setq state peek)))))
      (if retry
          nil
        ;; Innermost containing sexp found
        (goto-char (1+ containing-sexp))
        (if (not calculate-lisp-indent-last-sexp)
            ;; indent-point immediately follows open paren.
            ;; Don't call hook.
            (setq desired-indent (current-column))
          ;; Find the start of first element of containing sexp.
          (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
          (cond ((looking-at "\\s(")
                 ;; First element of containing sexp is a list.
                 ;; Indent under that list.
                 )
                ((> (save-excursion (forward-line 1) (point))
                    calculate-lisp-indent-last-sexp)
                 ;; This is the first line to start within the containing sexp.
                 ;; It's almost certainly a function call.
                 (if (or
                      ;; Containing sexp has nothing before this line
                      ;; except the first element. Indent under that element.
                      (= (point) calculate-lisp-indent-last-sexp)

                      ;; First sexp after `containing-sexp' is a keyword. This
                      ;; condition is more debatable. It's so that I can have
                      ;; unquoted plists in macros. It assumes that you won't
                      ;; make a function whose name is a keyword.
                      ;; (when-let (char-after (char-after (1+ containing-sexp)))
                      ;;   (char-equal char-after ?:))

                      ;; Check for quotes or backquotes around.
                      (let* ((positions (elt state 9))
                             (last (car (last positions)))
                             (rest (reverse (butlast positions)))
                             (any-quoted-p nil)
                             (point nil))
                        (or
                         (when-let (char (char-before last))
                           (or (char-equal char ?')
                               (char-equal char ?`)))
                         (progn
                           (while (and rest (not any-quoted-p))
                             (setq point (pop rest))
                             (setq any-quoted-p
                                   (or
                                    (when-let (char (char-before point))
                                      (or (char-equal char ?')
                                          (char-equal char ?`)))
                                    (save-excursion
                                      (goto-char (1+ point))
                                      (looking-at-p
                                       "\\(?:back\\)?quote[\t\n\f\s]+(")))))
                           any-quoted-p))))
                     ;; Containing sexp has nothing before this line
                     ;; except the first element.  Indent under that element.
                     nil
                   ;; Skip the first element, find start of second (the first
                   ;; argument of the function call) and indent under.
                   (progn (forward-sexp 1)
                          (parse-partial-sexp (point)
                                              calculate-lisp-indent-last-sexp
                                              0 t)))
                 (backward-prefix-chars))
                (t
                 ;; Indent beneath first sexp on same line as
                 ;; `calculate-lisp-indent-last-sexp'.  Again, it's
                 ;; almost certainly a function call.
                 (goto-char calculate-lisp-indent-last-sexp)
                 (beginning-of-line)
                 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp
                                     0 t)
                 (backward-prefix-chars)))))
      ;; Point is at the point to indent under unless we are inside a string.
      ;; Call indentation hook except when overridden by lisp-indent-offset
      ;; or if the desired indentation has already been computed.
      (let ((normal-indent (current-column)))
        (cond ((elt state 3)
               ;; Inside a string, don't change indentation.
               nil)
              ((and (integerp lisp-indent-offset) containing-sexp)
               ;; Indent by constant offset
               (goto-char containing-sexp)
               (+ (current-column) lisp-indent-offset))
              ;; in this case calculate-lisp-indent-last-sexp is not nil
              (calculate-lisp-indent-last-sexp
               (or
                ;; try to align the parameters of a known function
                (and lisp-indent-function
                     (not retry)
                     (funcall lisp-indent-function indent-point state))
                ;; If the function has no special alignment
                ;; or it does not apply to this argument,
                ;; try to align a constant-symbol under the last
                ;; preceding constant symbol, if there is such one of
                ;; the last 2 preceding symbols, in the previous
                ;; uncommented line.
                (and (save-excursion
                       (goto-char indent-point)
                       (skip-chars-forward " \t")
                       (looking-at ":"))
                     ;; The last sexp may not be at the indentation
                     ;; where it begins, so find that one, instead.
                     (save-excursion
                       (goto-char calculate-lisp-indent-last-sexp)
                       ;; Handle prefix characters and whitespace
                       ;; following an open paren.  (Bug#1012)
                       (backward-prefix-chars)
                       (while (not (or (looking-back "^[ \t]*\\|([ \t]+"
                                                     (line-beginning-position))
                                       (and containing-sexp
                                            (>= (1+ containing-sexp) (point)))))
                         (forward-sexp -1)
                         (backward-prefix-chars))
                       (setq calculate-lisp-indent-last-sexp (point)))
                     (> calculate-lisp-indent-last-sexp
                        (save-excursion
                          (goto-char (1+ containing-sexp))
                          (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
                          (point)))
                     (let ((parse-sexp-ignore-comments t)
                           indent)
                       (goto-char calculate-lisp-indent-last-sexp)
                       (or (and (looking-at ":")
                                (setq indent (current-column)))
                           (and (< (line-beginning-position)
                                   (prog2 (backward-sexp) (point)))
                                (looking-at ":")
                                (setq indent (current-column))))
                       indent))
                ;; another symbols or constants not preceded by a constant
                ;; as defined above.
                normal-indent))
              ;; in this case calculate-lisp-indent-last-sexp is nil
              (desired-indent)
              (t
               normal-indent))))))

Catatan Akhir

Perlu dicatat bahwa pertanyaan ini akan lebih digeneralisasikan sebagai cara untuk menghentikan emacs dari indentasi daftar yang dikutip dan tidak dikutip sebagai fungsi .

Aquaactress
sumber
Terima kasih! Ditulis dengan baik, jelas dan bermanfaat.
GaryO
1

Untuk alternatif yang jauh lebih peretas dari jawaban kaushalmodi, Anda dapat menimpa yang lisp-indent-functionserupa dengan yang dilakukan Mark H. Weaver untuk scheme-indent-functionmemperbaiki perataan kata kunci dalam Skema Guile.

Saya baru saja menyalin kode dari http://netris.org/~mhw/scheme-indent-function.el ; satu-satunya perubahan adalah menambahkan condklausa baru . Anda mungkin ingin mengambil kode saat ini lisp-indent-functiondaripada menggunakan fungsi ini apa adanya.

(Sayang sekali bahwa fungsi indentasi tidak mengekspos lebih banyak kait untuk menyederhanakan perubahan kecil seperti ini.)

(defun scheme-indent-function (indent-point state)
  "Scheme mode function for the value of the variable `lisp-indent-function'.
This behaves like the function `lisp-indent-function', except that:

i) it checks for a non-nil value of the property `scheme-indent-function'
\(or the deprecated `scheme-indent-hook'), rather than `lisp-indent-function'.

ii) if that property specifies a function, it is called with three
arguments (not two), the third argument being the default (i.e., current)
indentation."
  (let ((normal-indent (current-column)))
    (goto-char (1+ (elt state 1)))
    (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
    (if (and (elt state 2)
             (not (looking-at "\\sw\\|\\s_")))
        ;; car of form doesn't seem to be a symbol
        (progn
          (if (not (> (save-excursion (forward-line 1) (point))
                      calculate-lisp-indent-last-sexp))
              (progn (goto-char calculate-lisp-indent-last-sexp)
                     (beginning-of-line)
                     (parse-partial-sexp (point)
                     calculate-lisp-indent-last-sexp 0 t)))
          ;; Indent under the list or under the first sexp on the same
          ;; line as calculate-lisp-indent-last-sexp.  Note that first
          ;; thing on that line has to be complete sexp since we are
          ;; inside the innermost containing sexp.
          (backward-prefix-chars)
          (current-column))
      (let ((function (buffer-substring (point)
                    (progn (forward-sexp 1) (point))))
        method)
    (setq method (or (get (intern-soft function) 'scheme-indent-function)
             (get (intern-soft function) 'scheme-indent-hook)))
    (cond ((or (eq method 'defun)
           (and (null method)
            (> (length function) 3)
            (string-match "\\`def" function)))
           (lisp-indent-defform state indent-point))
              ;; This next cond clause is the only change -mhw
          ((and (null method)
                    (> (length function) 1)
                    ; The '#' in '#:' seems to get lost, not sure why
                    (string-match "\\`:" function))
               (let ((lisp-body-indent 1))
                 (lisp-indent-defform state indent-point)))
          ((integerp method)
           (lisp-indent-specform method state
                     indent-point normal-indent))
          (method
        (funcall method state indent-point normal-indent)))))))
rekado
sumber
Mengapa menimpanya dan tidak menggunakan variabel lisp-indent-function? Juga sepertinya tidak ada fungsi emacs-lisp-indent-function.
politza
Nah, lisp-indent-functionberisi fungsi indentasi secara default. Menentukan variabel ini identik dengan menimpa fungsi indentasi default untuk mode emacs-lisp. (Anda benar, tidak ada yang istimewa emacs-lisp-indent-function, hanya saja lisp-indent-function.)
rekado
Tapi itu jauh lebih sedikit `hacky '.
politza
1

Anda dapat mengganti lisp-indent-functiondengan cara bukti di masa depan menggunakan el-patch paket saya :

(el-patch-defun lisp-indent-function (indent-point state)
  "This function is the normal value of the variable `lisp-indent-function'.
The function `calculate-lisp-indent' calls this to determine
if the arguments of a Lisp function call should be indented specially.
INDENT-POINT is the position at which the line being indented begins.
Point is located at the point to indent under (for default indentation);
STATE is the `parse-partial-sexp' state for that position.
If the current line is in a call to a Lisp function that has a non-nil
property `lisp-indent-function' (or the deprecated `lisp-indent-hook'),
it specifies how to indent.  The property value can be:
* `defun', meaning indent `defun'-style
  (this is also the case if there is no property and the function
  has a name that begins with \"def\", and three or more arguments);
* an integer N, meaning indent the first N arguments specially
  (like ordinary function arguments), and then indent any further
  arguments like a body;
* a function to call that returns the indentation (or nil).
  `lisp-indent-function' calls this function with the same two arguments
  that it itself received.
This function returns either the indentation to use, or nil if the
Lisp function does not specify a special indentation."
  (el-patch-let (($cond (and (elt state 2)
                             (el-patch-wrap 1 1
                               (or (not (looking-at "\\sw\\|\\s_"))
                                   (looking-at ":")))))
                 ($then (progn
                          (if (not (> (save-excursion (forward-line 1) (point))
                                      calculate-lisp-indent-last-sexp))
                              (progn (goto-char calculate-lisp-indent-last-sexp)
                                     (beginning-of-line)
                                     (parse-partial-sexp (point)
                                                         calculate-lisp-indent-last-sexp 0 t)))
                          ;; Indent under the list or under the first sexp on the same
                          ;; line as calculate-lisp-indent-last-sexp.  Note that first
                          ;; thing on that line has to be complete sexp since we are
                          ;; inside the innermost containing sexp.
                          (backward-prefix-chars)
                          (current-column)))
                 ($else (let ((function (buffer-substring (point)
                                                          (progn (forward-sexp 1) (point))))
                              method)
                          (setq method (or (function-get (intern-soft function)
                                                         'lisp-indent-function)
                                           (get (intern-soft function) 'lisp-indent-hook)))
                          (cond ((or (eq method 'defun)
                                     (and (null method)
                                          (> (length function) 3)
                                          (string-match "\\`def" function)))
                                 (lisp-indent-defform state indent-point))
                                ((integerp method)
                                 (lisp-indent-specform method state
                                                       indent-point normal-indent))
                                (method
                                 (funcall method indent-point state))))))
    (let ((normal-indent (current-column))
          (el-patch-add
            (orig-point (point))))
      (goto-char (1+ (elt state 1)))
      (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
      (el-patch-swap
        (if $cond
            ;; car of form doesn't seem to be a symbol
            $then
          $else)
        (cond
         ;; car of form doesn't seem to be a symbol, or is a keyword
         ($cond $then)
         ((and (save-excursion
                 (goto-char indent-point)
                 (skip-syntax-forward " ")
                 (not (looking-at ":")))
               (save-excursion
                 (goto-char orig-point)
                 (looking-at ":")))
          (save-excursion
            (goto-char (+ 2 (elt state 1)))
            (current-column)))
         (t $else))))))

Ini memperbaiki masalah bagi saya; melihatnya dalam konteks .

Radon Rosborough
sumber