mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-19 02:10:10 +00:00
Merge remote-tracking branch 'savannah/master' into native-comp
This commit is contained in:
commit
b064ddd3f6
162 changed files with 3635 additions and 2579 deletions
|
@ -528,8 +528,14 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
|
|||
`(condition-case ,var ;Not evaluated.
|
||||
,(byte-optimize-form exp for-effect)
|
||||
,@(mapcar (lambda (clause)
|
||||
`(,(car clause)
|
||||
,@(byte-optimize-body (cdr clause) for-effect)))
|
||||
(let ((byte-optimize--lexvars
|
||||
(and lexical-binding
|
||||
(if var
|
||||
(cons (list var t)
|
||||
byte-optimize--lexvars)
|
||||
byte-optimize--lexvars))))
|
||||
(cons (car clause)
|
||||
(byte-optimize-body (cdr clause) for-effect))))
|
||||
clauses))))
|
||||
|
||||
(`(unwind-protect ,exp . ,exps)
|
||||
|
|
|
@ -498,7 +498,7 @@ places where they originally did not directly appear."
|
|||
(let* ((class (and var (cconv--var-classification (list var) form)))
|
||||
(newenv
|
||||
(cond ((eq class :captured+mutated)
|
||||
(cons `(,var . (car-save ,var)) env))
|
||||
(cons `(,var . (car-safe ,var)) env))
|
||||
((assq var env) (cons `(,var) env))
|
||||
(t env)))
|
||||
(msg (when (eq class :unused)
|
||||
|
|
|
@ -1242,7 +1242,7 @@ bound to \\<checkdoc-minor-mode-map>\\[checkdoc-eval-defun] and `checkdoc-eval-c
|
|||
checking of documentation strings.
|
||||
|
||||
\\{checkdoc-minor-mode-map}"
|
||||
nil checkdoc-minor-mode-string nil
|
||||
:lighter checkdoc-minor-mode-string
|
||||
:group 'checkdoc)
|
||||
|
||||
;;; Subst utils
|
||||
|
|
|
@ -2141,6 +2141,13 @@ Like `cl-flet' but the definitions can refer to previous ones.
|
|||
;; tail-called any more.
|
||||
(not (memq var shadowings)))))
|
||||
`(,(car exp) ,bindings . ,(funcall opt-exps exps)))
|
||||
((and `(condition-case ,err-var ,bodyform . ,handlers)
|
||||
(guard (not (eq err-var var))))
|
||||
`(condition-case ,err-var
|
||||
(progn (setq ,retvar ,bodyform) nil)
|
||||
. ,(mapcar (lambda (h)
|
||||
(cons (car h) (funcall opt-exps (cdr h))))
|
||||
handlers)))
|
||||
('nil nil) ;No need to set `retvar' to return nil.
|
||||
(_ `(progn (setq ,retvar ,exp) nil))))))
|
||||
|
||||
|
|
|
@ -139,39 +139,31 @@ documenting what its argument does. If the word \"ARG\" does not
|
|||
appear in DOC, a paragraph is added to DOC explaining
|
||||
usage of the mode argument.
|
||||
|
||||
Optional INIT-VALUE is the initial value of the mode's variable.
|
||||
Note that the minor mode function won't be called by setting
|
||||
this option, so the value *reflects* the minor mode's natural
|
||||
initial state, rather than *setting* it.
|
||||
In the vast majority of cases it should be nil.
|
||||
Optional LIGHTER is displayed in the mode line when the mode is on.
|
||||
Optional KEYMAP is the default keymap bound to the mode keymap.
|
||||
If non-nil, it should be a variable name (whose value is a keymap),
|
||||
or an expression that returns either a keymap or a list of
|
||||
(KEY . BINDING) pairs where KEY and BINDING are suitable for
|
||||
`define-key'. If you supply a KEYMAP argument that is not a
|
||||
symbol, this macro defines the variable MODE-map and gives it
|
||||
the value that KEYMAP specifies.
|
||||
|
||||
BODY contains code to execute each time the mode is enabled or disabled.
|
||||
It is executed after toggling the mode, and before running MODE-hook.
|
||||
Before the actual body code, you can write keyword arguments, i.e.
|
||||
alternating keywords and values. If you provide BODY, then you must
|
||||
provide (even if just nil) INIT-VALUE, LIGHTER, and KEYMAP, or provide
|
||||
at least one keyword argument, or both; otherwise, BODY would be
|
||||
misinterpreted as the first omitted argument. The following special
|
||||
provide at least one keyword argument. The following special
|
||||
keywords are supported (other keywords are passed to `defcustom' if
|
||||
the minor mode is global):
|
||||
|
||||
:group GROUP Custom group name to use in all generated `defcustom' forms.
|
||||
:global GLOBAL If non-nil specifies that the minor mode is not meant to be
|
||||
buffer-local, so don't make the variable MODE buffer-local.
|
||||
By default, the mode is buffer-local.
|
||||
:init-value VAL Same as the INIT-VALUE argument.
|
||||
:init-value VAL the initial value of the mode's variable.
|
||||
Note that the minor mode function won't be called by setting
|
||||
this option, so the value *reflects* the minor mode's natural
|
||||
initial state, rather than *setting* it.
|
||||
In the vast majority of cases it should be nil.
|
||||
Not used if you also specify :variable.
|
||||
:lighter SPEC Same as the LIGHTER argument.
|
||||
:keymap MAP Same as the KEYMAP argument.
|
||||
:require SYM Same as in `defcustom'.
|
||||
:lighter SPEC Text displayed in the mode line when the mode is on.
|
||||
:keymap MAP Keymap bound to the mode keymap. Defaults to `MODE-map'.
|
||||
If non-nil, it should be a variable name (whose value is
|
||||
a keymap), or an expression that returns either a keymap or
|
||||
a list of (KEY . BINDING) pairs where KEY and BINDING are
|
||||
suitable for `define-key'. If you supply a KEYMAP argument
|
||||
that is not a symbol, this macro defines the variable MODE-map
|
||||
and gives it the value that KEYMAP specifies.
|
||||
:interactive VAL Whether this mode should be a command or not. The default
|
||||
is to make it one; use nil to avoid that. If VAL is a list,
|
||||
it's interpreted as a list of major modes this minor mode
|
||||
|
@ -185,15 +177,18 @@ BODY contains code to execute each time the mode is enabled or disabled.
|
|||
sets it. If you specify a :variable, this function does
|
||||
not define a MODE variable (nor any of the terms used
|
||||
in :variable).
|
||||
|
||||
:after-hook A single lisp form which is evaluated after the mode hooks
|
||||
have been run. It should not be quoted.
|
||||
|
||||
For example, you could write
|
||||
(define-minor-mode foo-mode \"If enabled, foo on you!\"
|
||||
:lighter \" Foo\" :require \\='foo :global t :group \\='hassle :version \"27.5\"
|
||||
...BODY CODE...)"
|
||||
...BODY CODE...)
|
||||
|
||||
For backward compatibility with the Emacs<21 calling convention,
|
||||
BODY can also start with the triplet INIT-VALUE LIGHTER KEYMAP."
|
||||
(declare (doc-string 2)
|
||||
(advertised-calling-convention (mode doc &rest body) "28.1")
|
||||
(debug (&define name string-or-null-p
|
||||
[&optional [¬ keywordp] sexp
|
||||
&optional [¬ keywordp] sexp
|
||||
|
@ -201,23 +196,12 @@ For example, you could write
|
|||
[&rest [keywordp sexp]]
|
||||
def-body)))
|
||||
|
||||
;; Allow skipping the first three args.
|
||||
(cond
|
||||
((keywordp init-value)
|
||||
(setq body (if keymap `(,init-value ,lighter ,keymap ,@body)
|
||||
`(,init-value ,lighter))
|
||||
init-value nil lighter nil keymap nil))
|
||||
((keywordp lighter)
|
||||
(setq body `(,lighter ,keymap ,@body) lighter nil keymap nil))
|
||||
((keywordp keymap) (push keymap body) (setq keymap nil)))
|
||||
|
||||
(let* ((last-message (make-symbol "last-message"))
|
||||
(mode-name (symbol-name mode))
|
||||
(pretty-name (easy-mmode-pretty-mode-name mode lighter))
|
||||
(pretty-name nil)
|
||||
(globalp nil)
|
||||
(set nil)
|
||||
(initialize nil)
|
||||
(group nil)
|
||||
(type nil)
|
||||
(extra-args nil)
|
||||
(extra-keywords nil)
|
||||
|
@ -225,14 +209,28 @@ For example, you could write
|
|||
(setter `(setq ,mode)) ;The beginning of the exp to set the mode var.
|
||||
(getter mode) ;The exp to get the mode value.
|
||||
(modefun mode) ;The minor mode function name we're defining.
|
||||
(require t)
|
||||
(after-hook nil)
|
||||
(hook (intern (concat mode-name "-hook")))
|
||||
(hook-on (intern (concat mode-name "-on-hook")))
|
||||
(hook-off (intern (concat mode-name "-off-hook")))
|
||||
(interactive t)
|
||||
(warnwrap (if (keywordp init-value) #'identity
|
||||
(lambda (exp)
|
||||
(macroexp-warn-and-return
|
||||
"Use keywords rather than deprecated positional arguments to `define-minor-mode'"
|
||||
exp))))
|
||||
keyw keymap-sym tmp)
|
||||
|
||||
;; Allow skipping the first three args.
|
||||
(cond
|
||||
((keywordp init-value)
|
||||
(setq body (if keymap `(,init-value ,lighter ,keymap ,@body)
|
||||
`(,init-value ,lighter))
|
||||
init-value nil lighter nil keymap nil))
|
||||
((keywordp lighter)
|
||||
(setq body `(,lighter ,keymap ,@body) lighter nil keymap nil))
|
||||
((keywordp keymap) (push keymap body) (setq keymap nil)))
|
||||
|
||||
;; Check keys.
|
||||
(while (keywordp (setq keyw (car body)))
|
||||
(setq body (cdr body))
|
||||
|
@ -246,9 +244,7 @@ For example, you could write
|
|||
(:extra-args (setq extra-args (pop body)))
|
||||
(:set (setq set (list :set (pop body))))
|
||||
(:initialize (setq initialize (list :initialize (pop body))))
|
||||
(:group (setq group (nconc group (list :group (pop body)))))
|
||||
(:type (setq type (list :type (pop body))))
|
||||
(:require (setq require (pop body)))
|
||||
(:keymap (setq keymap (pop body)))
|
||||
(:interactive (setq interactive (pop body)))
|
||||
(:variable (setq variable (pop body))
|
||||
|
@ -264,6 +260,7 @@ For example, you could write
|
|||
(:after-hook (setq after-hook (pop body)))
|
||||
(_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
|
||||
|
||||
(setq pretty-name (easy-mmode-pretty-mode-name mode lighter))
|
||||
(setq keymap-sym (if (and keymap (symbolp keymap)) keymap
|
||||
(intern (concat mode-name "-map"))))
|
||||
|
||||
|
@ -301,70 +298,72 @@ or call the function `%s'."))))
|
|||
,(format base-doc-string pretty-name mode mode)
|
||||
,@set
|
||||
,@initialize
|
||||
,@group
|
||||
,@type
|
||||
,@(unless (eq require t) `(:require ,require))
|
||||
,@(nreverse extra-keywords)))))
|
||||
|
||||
;; The actual function.
|
||||
(defun ,modefun (&optional arg ,@extra-args)
|
||||
,(easy-mmode--mode-docstring doc pretty-name keymap-sym)
|
||||
,(when interactive
|
||||
;; Use `toggle' rather than (if ,mode 0 1) so that using
|
||||
;; repeat-command still does the toggling correctly.
|
||||
(if (consp interactive)
|
||||
`(interactive
|
||||
(list (if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
'toggle))
|
||||
,@interactive)
|
||||
'(interactive (list (if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
'toggle)))))
|
||||
(let ((,last-message (current-message)))
|
||||
(,@setter
|
||||
(cond ((eq arg 'toggle)
|
||||
(not ,getter))
|
||||
((and (numberp arg)
|
||||
(< arg 1))
|
||||
nil)
|
||||
(t
|
||||
t)))
|
||||
;; Keep minor modes list up to date.
|
||||
,@(if globalp
|
||||
;; When running this byte-compiled code in earlier
|
||||
;; Emacs versions, these variables may not be defined
|
||||
;; there. So check defensively, even if they're
|
||||
;; always defined in Emacs 28 and up.
|
||||
`((when (boundp 'global-minor-modes)
|
||||
(setq global-minor-modes
|
||||
(delq ',modefun global-minor-modes))
|
||||
(when ,getter
|
||||
(push ',modefun global-minor-modes))))
|
||||
;; Ditto check.
|
||||
`((when (boundp 'local-minor-modes)
|
||||
(setq local-minor-modes (delq ',modefun local-minor-modes))
|
||||
(when ,getter
|
||||
(push ',modefun local-minor-modes)))))
|
||||
,@body
|
||||
;; The on/off hooks are here for backward compatibility only.
|
||||
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))
|
||||
(if (called-interactively-p 'any)
|
||||
(progn
|
||||
,(if (and globalp (not variable))
|
||||
`(customize-mark-as-set ',mode))
|
||||
;; Avoid overwriting a message shown by the body,
|
||||
;; but do overwrite previous messages.
|
||||
(unless (and (current-message)
|
||||
(not (equal ,last-message
|
||||
(current-message))))
|
||||
(let ((local ,(if globalp "" " in current buffer")))
|
||||
(message ,(format "%s %%sabled%%s" pretty-name)
|
||||
(if ,getter "en" "dis") local)))))
|
||||
,@(when after-hook `(,after-hook)))
|
||||
(force-mode-line-update)
|
||||
;; Return the new setting.
|
||||
,getter)
|
||||
,(funcall
|
||||
warnwrap
|
||||
`(defun ,modefun (&optional arg ,@extra-args)
|
||||
,(easy-mmode--mode-docstring doc pretty-name keymap-sym)
|
||||
,(when interactive
|
||||
;; Use `toggle' rather than (if ,mode 0 1) so that using
|
||||
;; repeat-command still does the toggling correctly.
|
||||
(if (consp interactive)
|
||||
`(interactive
|
||||
(list (if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
'toggle))
|
||||
,@interactive)
|
||||
'(interactive
|
||||
(list (if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
'toggle)))))
|
||||
(let ((,last-message (current-message)))
|
||||
(,@setter
|
||||
(cond ((eq arg 'toggle)
|
||||
(not ,getter))
|
||||
((and (numberp arg)
|
||||
(< arg 1))
|
||||
nil)
|
||||
(t
|
||||
t)))
|
||||
;; Keep minor modes list up to date.
|
||||
,@(if globalp
|
||||
;; When running this byte-compiled code in earlier
|
||||
;; Emacs versions, these variables may not be defined
|
||||
;; there. So check defensively, even if they're
|
||||
;; always defined in Emacs 28 and up.
|
||||
`((when (boundp 'global-minor-modes)
|
||||
(setq global-minor-modes
|
||||
(delq ',modefun global-minor-modes))
|
||||
(when ,getter
|
||||
(push ',modefun global-minor-modes))))
|
||||
;; Ditto check.
|
||||
`((when (boundp 'local-minor-modes)
|
||||
(setq local-minor-modes
|
||||
(delq ',modefun local-minor-modes))
|
||||
(when ,getter
|
||||
(push ',modefun local-minor-modes)))))
|
||||
,@body
|
||||
;; The on/off hooks are here for backward compatibility only.
|
||||
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))
|
||||
(if (called-interactively-p 'any)
|
||||
(progn
|
||||
,(if (and globalp (not variable))
|
||||
`(customize-mark-as-set ',mode))
|
||||
;; Avoid overwriting a message shown by the body,
|
||||
;; but do overwrite previous messages.
|
||||
(unless (and (current-message)
|
||||
(not (equal ,last-message
|
||||
(current-message))))
|
||||
(let ((local ,(if globalp "" " in current buffer")))
|
||||
(message ,(format "%s %%sabled%%s" pretty-name)
|
||||
(if ,getter "en" "dis") local)))))
|
||||
,@(when after-hook `(,after-hook)))
|
||||
(force-mode-line-update)
|
||||
;; Return the new setting.
|
||||
,getter))
|
||||
|
||||
;; Autoloading a define-minor-mode autoloads everything
|
||||
;; up-to-here.
|
||||
|
|
|
@ -494,14 +494,16 @@ To implement dynamic menus, either call this from
|
|||
`menu-bar-update-hook' or use a menu filter."
|
||||
(easy-menu-add-item map path (easy-menu-create-menu name items) before))
|
||||
|
||||
(define-obsolete-function-alias 'easy-menu-remove #'ignore "28.1"
|
||||
(defalias 'easy-menu-remove #'ignore
|
||||
"Remove MENU from the current menu bar.
|
||||
Contrary to XEmacs, this is a nop on Emacs since menus are automatically
|
||||
\(de)activated when the corresponding keymap is (de)activated.
|
||||
|
||||
\(fn MENU)")
|
||||
(make-obsolete 'easy-menu-remove "this was always a no-op in Emacs \
|
||||
and can be safely removed." "28.1")
|
||||
|
||||
(define-obsolete-function-alias 'easy-menu-add #'ignore "28.1"
|
||||
(defalias 'easy-menu-add #'ignore
|
||||
"Add the menu to the menubar.
|
||||
On Emacs this is a nop, because menus are already automatically
|
||||
activated when the corresponding keymap is activated. On XEmacs
|
||||
|
@ -511,6 +513,8 @@ You should call this once the menu and keybindings are set up
|
|||
completely and menu filter functions can be expected to work.
|
||||
|
||||
\(fn MENU &optional MAP)")
|
||||
(make-obsolete 'easy-menu-add "this was always a no-op in Emacs \
|
||||
and can be safely removed." "28.1")
|
||||
|
||||
(defun add-submenu (menu-path submenu &optional before in-menu)
|
||||
"Add submenu SUBMENU in the menu at MENU-PATH.
|
||||
|
|
|
@ -1942,14 +1942,16 @@ a sequence of elements."
|
|||
;; Normally, &define is interpreted specially other places.
|
||||
;; This should only be called inside of a spec list to match the remainder
|
||||
;; of the current list. e.g. ("lambda" &define args def-body)
|
||||
(edebug-make-form-wrapper
|
||||
cursor
|
||||
(edebug-before-offset cursor)
|
||||
;; Find the last offset in the list.
|
||||
(let ((offsets (edebug-cursor-offsets cursor)))
|
||||
(while (consp offsets) (setq offsets (cdr offsets)))
|
||||
offsets)
|
||||
specs))
|
||||
(prog1 (edebug-make-form-wrapper
|
||||
cursor
|
||||
(edebug-before-offset cursor)
|
||||
;; Find the last offset in the list.
|
||||
(let ((offsets (edebug-cursor-offsets cursor)))
|
||||
(while (consp offsets) (setq offsets (cdr offsets)))
|
||||
offsets)
|
||||
specs)
|
||||
;; Stop backtracking here (Bug#41988).
|
||||
(setq edebug-gate t)))
|
||||
|
||||
(cl-defmethod edebug--match-&-spec-op ((_ (eql &name)) cursor specs)
|
||||
"Compute the name for `&name SPEC FUN` spec operator.
|
||||
|
@ -4114,12 +4116,12 @@ This should be a list of `edebug---frame' objects.")
|
|||
"Stack frames of the current Edebug Backtrace buffer with instrumentation.
|
||||
This should be a list of `edebug---frame' objects.")
|
||||
|
||||
;; Data structure for backtrace frames with information
|
||||
;; from Edebug instrumentation found in the backtrace.
|
||||
(cl-defstruct
|
||||
(edebug--frame
|
||||
(:constructor edebug--make-frame)
|
||||
(:include backtrace-frame))
|
||||
"Data structure for backtrace frames with information
|
||||
from Edebug instrumentation found in the backtrace."
|
||||
def-name before-index after-index)
|
||||
|
||||
(defun edebug-pop-to-backtrace ()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
;;; eieio-base.el --- Base classes for EIEIO. -*- lexical-binding:t -*-
|
||||
|
||||
;;; Copyright (C) 2000-2002, 2004-2005, 2007-2021 Free Software
|
||||
;;; Foundation, Inc.
|
||||
;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Eric M. Ludlam <zappo@gnu.org>
|
||||
;; Keywords: OO, lisp
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
(with-suppressed-warnings ((lexical pi))
|
||||
(defconst pi float-pi
|
||||
"Obsolete since Emacs-23.3. Use `float-pi' instead."))
|
||||
(make-obsolete-variable 'pi 'float-pi "23.3")
|
||||
(internal-make-var-non-special 'pi)
|
||||
|
||||
(defconst float-e (exp 1) "The value of e (2.7182818...).")
|
||||
|
|
|
@ -394,7 +394,8 @@ Assumes the caller has bound `macroexpand-all-environment'."
|
|||
|
||||
;; Record which arguments expect functions, so we can warn when those
|
||||
;; are accidentally quoted with ' rather than with #'
|
||||
(dolist (f '(funcall apply mapcar mapatoms mapconcat mapc cl-mapcar maphash))
|
||||
(dolist (f '( funcall apply mapcar mapatoms mapconcat mapc cl-mapcar maphash
|
||||
map-char-table map-keymap map-keymap-internal))
|
||||
(put f 'funarg-positions '(1)))
|
||||
(dolist (f '( add-hook remove-hook advice-remove advice--remove-function
|
||||
defalias fset global-set-key run-after-idle-timeout
|
||||
|
|
|
@ -182,7 +182,7 @@ by counted more than once."
|
|||
|
||||
(cl-defmethod memory-report--object-size-1 (_ (value symbol))
|
||||
;; Don't count global symbols -- makes sizes of lists of symbols too
|
||||
;; heavey.
|
||||
;; heavy.
|
||||
(if (intern-soft value obarray)
|
||||
0
|
||||
(memory-report--size 'symbol)))
|
||||
|
@ -214,14 +214,14 @@ by counted more than once."
|
|||
(setf (gethash value counted) t)
|
||||
(when (car value)
|
||||
(cl-incf total (memory-report--object-size counted (car value))))
|
||||
(if (cdr value)
|
||||
(if (consp (cdr value))
|
||||
(if (gethash (cdr value) counted)
|
||||
(setq value nil)
|
||||
(setq value (cdr value)))
|
||||
(cl-incf total (memory-report--object-size counted (cdr value)))
|
||||
(setq value nil))
|
||||
(setq value nil)))
|
||||
(let ((next (cdr value)))
|
||||
(setq value (when next
|
||||
(if (consp next)
|
||||
(unless (gethash next counted)
|
||||
(cdr value))
|
||||
(cl-incf total (memory-report--object-size
|
||||
counted next))
|
||||
nil)))))
|
||||
total))
|
||||
|
||||
(cl-defmethod memory-report--object-size-1 (counted (value vector))
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
;;
|
||||
;; SMIE: Weakness is Power! Auto-indentation with incomplete information
|
||||
;; Stefan Monnier, <Programming> Journal 2020, volumn 5, issue 1.
|
||||
;; doi: 10.22152/programming-journal.org/2020/5/1
|
||||
;; doi: 10.22152/programming-journal.org/2021/5/1
|
||||
|
||||
;; A good background to understand the development (especially the parts
|
||||
;; building the 2D precedence tables and then computing the precedence levels
|
||||
|
@ -68,7 +68,7 @@
|
|||
;; OTOH we had to kill many chickens, read many coffee grounds, and practice
|
||||
;; untold numbers of black magic spells, to come up with the indentation code.
|
||||
;; Since then, some of that code has been beaten into submission, but the
|
||||
;; smie-indent-keyword is still pretty obscure.
|
||||
;; `smie-indent-keyword' function is still pretty obscure.
|
||||
|
||||
|
||||
;; Conflict resolution:
|
||||
|
@ -247,7 +247,7 @@ be either:
|
|||
;; (exp (exp (or "+" "*" "=" ..) exp)).
|
||||
;; Basically, make it EBNF (except for the specification of a separator in
|
||||
;; the repetition, maybe).
|
||||
(let* ((nts (mapcar 'car bnf)) ;Non-terminals.
|
||||
(let* ((nts (mapcar #'car bnf)) ;Non-terminals.
|
||||
(first-ops-table ())
|
||||
(last-ops-table ())
|
||||
(first-nts-table ())
|
||||
|
@ -266,7 +266,7 @@ be either:
|
|||
(push resolver precs))
|
||||
(t (error "Unknown resolver %S" resolver))))
|
||||
(apply #'smie-merge-prec2s over
|
||||
(mapcar 'smie-precs->prec2 precs))))
|
||||
(mapcar #'smie-precs->prec2 precs))))
|
||||
again)
|
||||
(dolist (rules bnf)
|
||||
(let ((nt (car rules))
|
||||
|
@ -497,7 +497,7 @@ CSTS is a list of pairs representing arcs in a graph."
|
|||
res))
|
||||
cycle)))
|
||||
(mapconcat
|
||||
(lambda (elems) (mapconcat 'identity elems "="))
|
||||
(lambda (elems) (mapconcat #'identity elems "="))
|
||||
(append names (list (car names)))
|
||||
" < ")))
|
||||
|
||||
|
@ -567,7 +567,7 @@ PREC2 is a table as returned by `smie-precs->prec2' or
|
|||
;; Then eliminate trivial constraints iteratively.
|
||||
(let ((i 0))
|
||||
(while csts
|
||||
(let ((rhvs (mapcar 'cdr csts))
|
||||
(let ((rhvs (mapcar #'cdr csts))
|
||||
(progress nil))
|
||||
(dolist (cst csts)
|
||||
(unless (memq (car cst) rhvs)
|
||||
|
@ -657,8 +657,8 @@ use syntax-tables to handle them in efficient C code.")
|
|||
Same calling convention as `smie-forward-token-function' except
|
||||
it should move backward to the beginning of the previous token.")
|
||||
|
||||
(defalias 'smie-op-left 'car)
|
||||
(defalias 'smie-op-right 'cadr)
|
||||
(defalias 'smie-op-left #'car)
|
||||
(defalias 'smie-op-right #'cadr)
|
||||
|
||||
(defun smie-default-backward-token ()
|
||||
(forward-comment (- (point)))
|
||||
|
@ -974,8 +974,7 @@ I.e. a good choice can be:
|
|||
(defcustom smie-blink-matching-inners t
|
||||
"Whether SMIE should blink to matching opener for inner keywords.
|
||||
If non-nil, it will blink not only for \"begin..end\" but also for \"if...else\"."
|
||||
:type 'boolean
|
||||
:group 'smie)
|
||||
:type 'boolean)
|
||||
|
||||
(defun smie-blink-matching-check (start end)
|
||||
(save-excursion
|
||||
|
@ -1141,8 +1140,7 @@ OPENER is non-nil if TOKEN is an opener and nil if it's a closer."
|
|||
|
||||
(defcustom smie-indent-basic 4
|
||||
"Basic amount of indentation."
|
||||
:type 'integer
|
||||
:group 'smie)
|
||||
:type 'integer)
|
||||
|
||||
(defvar smie-rules-function #'ignore
|
||||
"Function providing the indentation rules.
|
||||
|
@ -1189,7 +1187,7 @@ designed specifically for use in this function.")
|
|||
(and ;; (looking-at comment-start-skip) ;(bug#16041).
|
||||
(forward-comment (point-max))))))
|
||||
|
||||
(defalias 'smie-rule-hanging-p 'smie-indent--hanging-p)
|
||||
(defalias 'smie-rule-hanging-p #'smie-indent--hanging-p)
|
||||
(defun smie-indent--hanging-p ()
|
||||
"Return non-nil if the current token is \"hanging\".
|
||||
A hanging keyword is one that's at the end of a line except it's not at
|
||||
|
@ -1205,7 +1203,7 @@ the beginning of a line."
|
|||
(funcall smie--hanging-eolp-function)
|
||||
(point))))))
|
||||
|
||||
(defalias 'smie-rule-bolp 'smie-indent--bolp)
|
||||
(defalias 'smie-rule-bolp #'smie-indent--bolp)
|
||||
(defun smie-indent--bolp ()
|
||||
"Return non-nil if the current token is the first on the line."
|
||||
(save-excursion (skip-chars-backward " \t") (bolp)))
|
||||
|
@ -1421,7 +1419,7 @@ BASE-POS is the position relative to which offsets should be applied."
|
|||
(forward-sexp 1)
|
||||
nil)
|
||||
((eobp) nil)
|
||||
(t (error "Bumped into unknown token")))))
|
||||
(t (error "Bumped into unknown token: %S" tok)))))
|
||||
|
||||
(defun smie-indent-backward-token ()
|
||||
"Skip token backward and return it, along with its levels."
|
||||
|
@ -1810,9 +1808,11 @@ Each function is called with no argument, shouldn't move point, and should
|
|||
return either nil if it has no opinion, or an integer representing the column
|
||||
to which that point should be aligned, if we were to reindent it.")
|
||||
|
||||
(defalias 'smie--funcall #'funcall) ;Debugging/tracing convenience indirection.
|
||||
|
||||
(defun smie-indent-calculate ()
|
||||
"Compute the indentation to use for point."
|
||||
(run-hook-with-args-until-success 'smie-indent-functions))
|
||||
(run-hook-wrapped 'smie-indent-functions #'smie--funcall))
|
||||
|
||||
(defun smie-indent-line ()
|
||||
"Indent current line using the SMIE indentation engine."
|
||||
|
@ -2016,7 +2016,7 @@ value with which to replace it."
|
|||
;; FIXME improve value-type.
|
||||
:type '(choice (const nil)
|
||||
(alist :key-type symbol))
|
||||
:initialize 'custom-initialize-set
|
||||
:initialize #'custom-initialize-set
|
||||
:set #'smie-config--setter)
|
||||
|
||||
(defun smie-config-local (rules)
|
||||
|
|
|
@ -410,8 +410,7 @@ specified by `tabulated-list-sort-key'. It then erases the
|
|||
buffer and inserts the entries with `tabulated-list-printer'.
|
||||
|
||||
Optional argument REMEMBER-POS, if non-nil, means to move point
|
||||
to the entry with the same ID element as the current line and
|
||||
recenter window line accordingly.
|
||||
to the entry with the same ID element as the current line.
|
||||
|
||||
Non-nil UPDATE argument means to use an alternative printing
|
||||
method which is faster if most entries haven't changed since the
|
||||
|
@ -424,18 +423,10 @@ changing `tabulated-list-sort-key'."
|
|||
(funcall tabulated-list-entries)
|
||||
tabulated-list-entries))
|
||||
(sorter (tabulated-list--get-sorter))
|
||||
entry-id saved-pt saved-col window-line)
|
||||
entry-id saved-pt saved-col)
|
||||
(and remember-pos
|
||||
(setq entry-id (tabulated-list-get-id))
|
||||
(setq saved-col (current-column))
|
||||
(when (eq (window-buffer) (current-buffer))
|
||||
(setq window-line
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(narrow-to-region (window-start) (point))
|
||||
(goto-char (point-min))
|
||||
(vertical-motion (buffer-size)))))))
|
||||
(setq saved-col (current-column)))
|
||||
;; Sort the entries, if necessary.
|
||||
(when sorter
|
||||
(setq entries (sort entries sorter)))
|
||||
|
@ -490,9 +481,7 @@ changing `tabulated-list-sort-key'."
|
|||
;; If REMEMBER-POS was specified, move to the "old" location.
|
||||
(if saved-pt
|
||||
(progn (goto-char saved-pt)
|
||||
(move-to-column saved-col)
|
||||
(when window-line
|
||||
(recenter window-line)))
|
||||
(move-to-column saved-col))
|
||||
(goto-char (point-min)))))
|
||||
|
||||
(defun tabulated-list-print-entry (id cols)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue