emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 32df203: Remove the "def" indentation heuristic


From: Lars Ingebrigtsen
Subject: master 32df203: Remove the "def" indentation heuristic
Date: Mon, 18 Oct 2021 04:00:29 -0400 (EDT)

branch: master
commit 32df2034234056bf24312ef5883671b59a387520
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Remove the "def" indentation heuristic
    
    * lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Don't
    indent function calls with names that that start with "def"
    specially (bug#43329).
---
 etc/NEWS                                             | 20 ++++++++++++++++++++
 lisp/emacs-lisp/lisp-mode.el                         |  3 ---
 .../elisp-mode-resources/elisp-indents.erts          | 14 ++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index f4b4625..2ef585f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -165,6 +165,26 @@ Emacs buffers, like indentation and the like.  The new ert 
function
 * Incompatible Lisp Changes in Emacs 29.1
 
 ---
+** 'def' indentation changes.
+In 'emacs-lisp-mode', forms with a symbol with a name that start with
+"def" have been automatically indented as if they were 'defun'-like
+forms, for instance:
+
+  (defzot 1
+    2 3)
+
+This heuristic has now been removed, and all functions/macros that
+want to be indented this way have to be marked with
+
+  (declare (indent defun))
+
+or the like.  If the function/macro definition itself can't be
+changed, the indentation can also be adjusted by saying something
+like:
+
+  (put 'defzot 'lisp-indent-function 'defun)
+
+---
 ** The 'inhibit-changing-match-data' variable is now obsolete.
 Instead, functions like 'string-match' and 'looking-at' now take an
 optional 'inhibit-modify' argument.
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index c2f756c..fadc0a7 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1220,9 +1220,6 @@ Lisp function does not specify a special indentation."
                                        '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))
                    ;; Check whether we are in flet-like form.
                    (lisp--local-defform-body-p state))
               (lisp-indent-defform state indent-point))
diff --git a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts 
b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts
index d3eaac9..ba2f81a 100644
--- a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts
+++ b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts
@@ -57,3 +57,17 @@ Name: defvar-keymap
   :foo bar
   "\r" #'eww-follow-link)
 =-=-=
+
+Name: def-indent1
+
+=-=
+(defzot-does-not-exist 1
+                       2 3)
+=-=-=
+
+Name: def-indent2
+
+=-=
+(define-keymap 1
+  2 3)
+=-=-=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]