Subject: 24.3; Common Lisp simple loop differentiation

From: Svante Carl v. Erichsen <[email-masked]>
Date: Sun, 06 Oct 2013 20:33:24 +0200 (CEST)

When common-lisp-indent-function is active, the indentation of loop
forms is not correct when keywords are used as loop keyword
designators (e.g. ":for" instead of "for").  This is caused by
extended-loop-p not recognizing a \: as starting an extended loop
keyword.  Extended loops thus get incorrectly treated as simple loops
in this case.

Common-lisp-loop-part-indentation (which is the next toplevel form in
cl-indent.el) treats \: correctly.

A simple patch could be like this:
--------------------------------------------------
--- /usr/share/emacs/24.3/lisp/emacs-lisp/cl-indent.el	2013-01-01 21:37:17.000000000 +0100
+++ cl-indent.el	2013-10-06 20:18:15.591013753 +0200
@@ -151,7 +151,7 @@
 	(forward-char 1)
 	(forward-sexp 2)
 	(backward-sexp 1)
-	(looking-at "\\sw"))
+	(looking-at "\\(:\\|\\sw\\)"))
     (error t)))

--------------------------------------------------

Best wishes

Svante v. Erichsen

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, Motif Version 2.3.4)
 of 2013-08-20 on alraune
Windowing system distributor `The X.Org Foundation', version 11.0.11403000
Configured using:
 `configure '--prefix=/usr' '--build=x86_64-pc-linux-gnu'
 '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--datadir=/usr/share'
 '--sysconfdir=/etc' '--localstatedir=/var/lib' '--libdir=/usr/lib64'
 '--disable-dependency-tracking' '--program-suffix=-emacs-24'
 '--infodir=/usr/share/info/emacs-24'
 '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64'
 '--with-gameuser=games' '--without-compress-info' '--without-hesiod'
 '--without-kerberos' '--without-kerberos5' '--without-gpm'
 '--without-dbus' '--without-gnutls' '--without-xml2'
 '--without-selinux' '--without-wide-int' '--with-sound' '--with-x'
 '--without-ns' '--without-gconf' '--without-gsettings'
 '--without-toolkit-scroll-bars' '--with-gif' '--with-jpeg'
 '--with-png' '--with-rsvg' '--with-tiff' '--with-xpm'
 '--with-imagemagick' '--without-xft' '--without-libotf'
 '--without-m17n-flt' '--with-x-toolkit=motif'
 'GENTOO_PACKAGE=app-editors/emacs-24.3-r2'
 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
 'CFLAGS=-O2 -march=core2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'
 'CPPFLAGS=''

Important settings:
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  paredit-mode: t
  recentf-mode: t
  display-battery-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
M-b M-b M-b M-f M-f M-f M-f M-b M-b M-b M-b t o SPC 
v e r t e x SPC ~ s SPC M-f M-f M-f M-f . C-f SPC e 
d g e SPC g <backspace> v e r t e x C-x C-s M-b M-b 
C-b <return> <tab> C-x C-s C-p C-p C-p C-p C-p C-p 
C-n C-n C-n C-n C-n C-p C-e C-b C-b C-b C-SPC C-n C-b 
C-n C-b M-w C-p C-p C-p C-p C-p C-p C-p C-e C-b C-y 
C-p C-e C-b M-b M-d g i r l C-x C-s M-q C-_ C-n M-q 
M-q C-p C-e M-q M-q C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-x C-s M-> C-p M-m C-M-k M-^ C-x C-s C-x C-f C-g 
C-x C-y C-n C-n C-n C-n C-n C-n C-n C-n C-n <return> 
M-> C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-e <return> <return> C-p C-k C-x C-s C-p 
C-e <return> ( l o a d - u s e r - f i l e SPC " r 
e p a i r - l o o p - i n d e n t . e l C-x C-s C-x 
C-f r e p a i r - l o o p - i n d e n t . e l <return> 
( <backspace> C-y C-_ <down-mouse-2> <mouse-2> ) C-x 
C-s C-p C-f C-f C-f C-f C-f C-f \ \ ( C-f C-f C-f C-f 
\ \ ) C-b C-b C-b C-b C-b C-b C-b : \ \ | C-x C-s C-n 
C-x C-e C-n C-n C-n C-c s l M-q C-x C-y C-n <return> 
M-x r e p o <tab> r t - e m a c s - b u g <return>

Recent messages:
Missing closing delimiter: )
Saving file /home/svante/.emacs.d/repair-loop-indent.el...
Wrote /home/svante/.emacs.d/repair-loop-indent.el
Saving file /home/svante/.emacs.d/repair-loop-indent.el...
Wrote /home/svante/.emacs.d/repair-loop-indent.el
extended-loop-p
byte-code: End of buffer [2 times]
Select [4?cdeilnqrstv]: 
Open /home/svante/.emacs.d/repair-loop-indent.el
Making completion list...

Load-path shadows:
None found.

Features:
(shadow emacsbug message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mail-utils cus-edit cus-start cus-load
etags tabify sgml-mode org-wl org-w3m org-vm org-rmail org-mhe org-mew
org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks
org-agenda org-info org-gnus org-docview org-bibtex bibtex org-bbdb
org ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint
ob-keys org-pcomplete pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob org-compat org-macs
ob-eval org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs conf-mode slime-asdf misearch multi-isearch compile
mule-util w3m-form w3m-bookmark w3m-tabmenu w3m-session w3m doc-view
jka-compr dired image-mode timezone w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util eldoc
warnings slime-fancy slime-fontifying-fu slime-package-fu
slime-references slime-scratch slime-presentations slime-fuzzy
slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc advice advice-preload slime-parse
slime-repl slime derived help-fns easy-mmode comint ansi-color ring
hyperspec cl-macs gv thingatpt browse-url cl cl-lib help-mode pp
network-stream auth-source eieio byte-opt bytecomp byte-compile cconv
gnus-util mm-util mail-prsvr password-cache starttls tls mew-varsx
mew-unix mew-auth mew-config mew-imap2 mew-imap mew-nntp2 mew-nntp
mew-pop mew-smtp mew-ssl mew-ssh mew-net mew-highlight mew-sort
mew-fib mew-ext mew-refile mew-demo mew-attach mew-draft mew-message
mew-thread mew-virtual mew-summary4 mew-summary3 mew-summary2
mew-summary mew-search mew-pick mew-passwd mew-scan mew-syntax mew-bq
mew-smime mew-pgp mew-header mew-exec mew-mark mew-mime mew-edit
mew-decode mew-encode mew-cache mew-minibuf mew-complete mew-addrbook
mew-local mew-vars3 mew-vars2 mew-vars mew-env mew-mule3 mew-mule
mew-gemacs mew-key mew-func mew-blvs mew-const mew paredit edmacro
kmacro info-look info slime-autoloads recentf tree-widget wid-edit
easymenu battery paren time server site-gentoo w3m-load tex-site
auto-loads time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dynamic-setting motif x-toolkit x multi-tty
emacs)