summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mode.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-10-05 10:34:37 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-10-05 10:34:37 +0200
commit4103123806311aa42f8ee22082015c0a7c3e30dd (patch)
tree027f0e6a14ed49fe4842fe5a5243d35dc84f40b3 /lisp/emacs-lisp/lisp-mode.el
parent947aee281c1f6d891a5770e70735697fe3c3e1a7 (diff)
downloademacs-4103123806311aa42f8ee22082015c0a7c3e30dd.tar.gz
Change the call convention for `defvar-keymap'
* doc/lispref/keymaps.texi (Changing Key Bindings): Adjust documentation. * lisp/simple.el (special-mode-map): * lisp/net/shr.el (shr-map): * lisp/net/eww.el (eww-link-keymap): (eww-mode-map): (eww-submit-map): (eww-textarea-map): (eww-bookmark-mode-map): (eww-history-mode-map): (eww-buffers-mode-map): * lisp/gnus/message.el (message-mode-map): * lisp/gnus/gnus-html.el (gnus-html-image-map): * lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map): * lisp/gnus/gnus-dired.el (gnus-dired-mode-map): * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map): Adjust usage of `defvar-keymap'. * lisp/subr.el (define-keymap, define-keymap--define): Change how these functions call each other. (defvar-keymap): Change interface to be more like `define-keymap'. * lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): Remove. (lisp-indent-function): Don't use it.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r--lisp/emacs-lisp/lisp-mode.el63
1 files changed, 23 insertions, 40 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index a465d189b7a..57196dfec49 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1162,18 +1162,6 @@ STATE is the `parse-partial-sexp' state for current position."
(goto-char (scan-lists (point) -1 0))
(point)))))))))))
-(defun lisp-indent--defvar-keymap (state)
- "Return the indent position in the options part of a `defvar-keymap' form."
- (save-excursion
- (let ((parens (ppss-open-parens state)))
- (and (equal (nth 1 parens) (ppss-innermost-start state))
- (progn
- (goto-char (nth 0 parens))
- (looking-at-p "(defvar-keymap"))
- (progn
- (goto-char (ppss-innermost-start state))
- (1+ (current-column)))))))
-
(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
@@ -1207,12 +1195,10 @@ Lisp function does not specify a special indentation."
(if (and (elt state 2)
(not (looking-at "\\sw\\|\\s_")))
;; car of form doesn't seem to be a symbol
- (cond
- ((lisp--local-defform-body-p state)
- ;; We nevertheless check whether we are in flet-like form
- ;; as we presume local function names could be non-symbols.
- (lisp-indent-defform state indent-point))
- (t
+ (if (lisp--local-defform-body-p state)
+ ;; We nevertheless check whether we are in flet-like form
+ ;; as we presume local function names could be non-symbols.
+ (lisp-indent-defform state indent-point)
(if (not (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp))
(progn (goto-char calculate-lisp-indent-last-sexp)
@@ -1224,28 +1210,25 @@ Lisp function does not specify a special indentation."
;; thing on that line has to be complete sexp since we are
;; inside the innermost containing sexp.
(backward-prefix-chars)
- (current-column)))
- ;; Indent `defvar-keymap' arguments.
- (or (lisp-indent--defvar-keymap state)
- ;; Other forms.
- (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))
- ;; Check whether we are in flet-like form.
- (lisp--local-defform-body-p state))
- (lisp-indent-defform state indent-point))
- ((integerp method)
- (lisp-indent-specform method state
- indent-point normal-indent))
- (method
- (funcall method indent-point state))))))))
+ (current-column))
+ (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))
+ ;; Check whether we are in flet-like form.
+ (lisp--local-defform-body-p state))
+ (lisp-indent-defform state indent-point))
+ ((integerp method)
+ (lisp-indent-specform method state
+ indent-point normal-indent))
+ (method
+ (funcall method indent-point state)))))))
(defcustom lisp-body-indent 2
"Number of columns to indent the second line of a `(def...)' form."