diff options
| author | K. Handa <handa@gnu.org> | 2015-09-27 17:06:12 +0900 |
|---|---|---|
| committer | K. Handa <handa@gnu.org> | 2015-09-27 17:06:12 +0900 |
| commit | 52beda922d2cb523a03661bf74b8678c8b45e440 (patch) | |
| tree | 04617b37298746a61d5324a5b35c9b71f439d762 /lisp/emacs-lisp | |
| parent | 94ed5167557112fb00eeca05e62589db744206de (diff) | |
| parent | 1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff) | |
| download | emacs-52beda922d2cb523a03661bf74b8678c8b45e440.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/emacs-lisp')
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/avl-tree.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 14 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cconv.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/check-declare.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 74 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 13 | ||||
| -rw-r--r-- | lisp/emacs-lisp/ert-x.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 12 | ||||
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/gv.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 126 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/map-ynp.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/rx.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 21 | ||||
| -rw-r--r-- | lisp/emacs-lisp/shadow.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/smie.el | 19 | ||||
| -rw-r--r-- | lisp/emacs-lisp/syntax.el | 98 | ||||
| -rw-r--r-- | lisp/emacs-lisp/timer.el | 32 |
25 files changed, 251 insertions, 211 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 62330fca71b..4ee830023fc 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -168,7 +168,8 @@ ;; "Switch to non-existing buffers only upon confirmation." ;; (interactive "BSwitch to buffer: ") ;; (if (or (get-buffer (ad-get-arg 0)) -;; (y-or-n-p (format "‘%s’ does not exist, create? " (ad-get-arg 0)))) +;; (y-or-n-p (format-message "`%s' does not exist, create? " +;; (ad-get-arg 0)))) ;; ad-do-it)) ;; ;;(defadvice find-file (before existing-files-only activate) @@ -3106,7 +3107,7 @@ deactivation, which might run hooks and get into other trouble." "Define a piece of advice for FUNCTION (a symbol). The syntax of `defadvice' is as follows: - \(defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...) + (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...) [DOCSTRING] [INTERACTIVE-FORM] BODY...) diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el index e3d83eb127f..99a329b021e 100644 --- a/lisp/emacs-lisp/avl-tree.el +++ b/lisp/emacs-lisp/avl-tree.el @@ -615,7 +615,7 @@ is more efficient." of all elements of TREE. If REVERSE is non-nil, the stack is sorted in reverse order. -\(See also `avl-tree-stack-pop'\). +\(See also `avl-tree-stack-pop'). Note that any modification to TREE *immediately* invalidates all avl-tree-stacks created before the modification (in particular, diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 279ffa37b7e..8699af60ea8 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -397,7 +397,7 @@ invoked interactively are excluded from this list." "Alist of functions and their call tree. Each element looks like - \(FUNCTION CALLERS CALLS\) + (FUNCTION CALLERS CALLS) where CALLERS is a list of functions that call FUNCTION, and CALLS is a list of functions for which calls were generated while compiling @@ -1814,7 +1814,7 @@ The value is non-nil if there were no errors, nil if errors." ;; compile this file. (if (with-current-buffer input-buffer no-byte-compile) (progn - ;; (message "%s not compiled because of ‘no-byte-compile: %s’" + ;; (message "%s not compiled because of `no-byte-compile: %s'" ;; (byte-compile-abbreviate-file filename) ;; (with-current-buffer input-buffer no-byte-compile)) (when (file-exists-p target-file) @@ -4196,7 +4196,7 @@ binding slots have been popped." ;; (consp (get condition ;; 'error-conditions))))) ;; (byte-compile-warn - ;; "‘%s’ is not a known condition name + ;; "`%s' is not a known condition name ;; (in condition-case)" ;; condition)) ) @@ -4235,7 +4235,7 @@ binding slots have been popped." ;; for the argument to `signal', not to `condition-case'. ;;(unless (consp (get c 'error-conditions)) ;; (byte-compile-warn - ;; "‘%s’ is not a known condition name (in condition-case)" + ;; "`%s' is not a known condition name (in condition-case)" ;; c)) ) (byte-compile-push-constant condition)) @@ -4529,11 +4529,11 @@ whose definitions have been compiled in this Emacs session, as well as all functions called by those functions. The call graph does not include macros, inline functions, or -primitives that the byte-code interpreter knows about directly \(eq, -cons, etc.\). +primitives that the byte-code interpreter knows about directly +\(`eq', `cons', etc.). The call tree also lists those functions which are not known to be called -\(that is, to which no calls have been compiled\), and which cannot be +\(that is, to which no calls have been compiled), and which cannot be invoked interactively." (interactive) (message "Generating call tree...") diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 205ae6d711e..0f75f0a1664 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -679,7 +679,7 @@ and updates the data stored in ENV." ;; ((and `(quote ,v . ,_) (guard (assq v env))) ;; (byte-compile-log-warning - ;; (format-message "Possible confusion variable/symbol for ‘%S’" v))) + ;; (format-message "Possible confusion variable/symbol for `%S'" v))) (`(quote . ,_) nil) ; quote form (`(function . ,_) nil) ; same as quote diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 3b69e959282..536e4186c41 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -162,7 +162,7 @@ def\\(?:un\\|subst\\|foo\\|method\\|class\\|\ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\\|\ \\(?:ine-obsolete-function-\\)?alias[ \t]+'\\|\ ine-overloadable-function\\)\\)\ -\[ \t]*%s\\([ \t;]+\\|$\\)") +[ \t]*%s\\([ \t;]+\\|$\\)") (regexp-opt (mapcar 'cadr fnlist) t))) (while (re-search-forward re nil t) (skip-chars-forward " \t\n") diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 4a9e16ae88e..bf1a21acaf1 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1663,7 +1663,7 @@ function,command,variable,option or symbol." ms1)))))) ;; (concat "\\<" (regexp-quote (car fp)) "\\>") ;; newname)) ;; (checkdoc-create-error - ;; "Flag variable names should normally end in ‘-flag’" s + ;; "Flag variable names should normally end in `-flag'" s ;; (marker-position e))))) ;; Done with variables )) diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index c012a30a41f..dd01ebe9dd8 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -1069,8 +1069,11 @@ The value returned is a list of elements of the form (or (and (assq type cl--generic-typeof-types) (progn - (if (memq type '(vector array sequence)) - (message "`%S' also matches CL structs and EIEIO classes" type)) + ;; FIXME: While this wrinkle in the semantics can be occasionally + ;; problematic, this warning is more often annoying than helpful. + ;;(if (memq type '(vector array sequence)) + ;; (message "`%S' also matches CL structs and EIEIO classes" + ;; type)) (list cl--generic-typeof-generalizer))) (cl-call-next-method))) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index eab22b67cd7..56f95111ab8 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -136,7 +136,7 @@ BODY contains code to execute each time the mode is enabled or disabled. :variable PLACE The location to use instead of the variable MODE to store the state of the mode. This can be simply a different named variable, or a generalized variable. - PLACE can also be of the form \(GET . SET), where GET is + PLACE can also be of the form (GET . SET), where GET is an expression that returns the current state, and SET is a function that takes one argument, the new state, and sets it. If you specify a :variable, this function does diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 0162a9a230a..a3e3b567cc4 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3162,12 +3162,12 @@ Do this when stopped before the form or it will be too late. One side effect of using this command is that the next time the function or macro is called, Edebug will be called there as well." (interactive) - (if (not (looking-at "\(")) + (if (not (looking-at "(")) (error "You must be before a list form") (let ((func (save-excursion (down-list 1) - (if (looking-at "\(") + (if (looking-at "(") (edebug--form-data-name (edebug-get-form-data-entry (point))) (read (current-buffer)))))) @@ -3216,57 +3216,45 @@ This is useful for exiting even if `unwind-protect' code may be executed." (setq edebug-execution-mode 'Go-nonstop) (top-level)) - ;;(defun edebug-exit-out () ;; "Go until the current function exits." ;; (interactive) ;; (edebug-set-mode 'exiting "Exit...")) - -;;; The following initial mode setting definitions are not used yet. - -'(defconst edebug-initial-mode-alist - '((edebug-Continue-fast . Continue-fast) - (edebug-Trace-fast . Trace-fast) - (edebug-continue . continue) - (edebug-trace . trace) - (edebug-go . go) - (edebug-step-through . step) - (edebug-Go-nonstop . Go-nonstop) - ) +(defconst edebug-initial-mode-alist + '((edebug-step-mode . step) + (edebug-next-mode . next) + (edebug-trace-mode . trace) + (edebug-Trace-fast-mode . Trace-fast) + (edebug-go-mode . go) + (edebug-continue-mode . continue) + (edebug-Continue-fast-mode . Continue-fast) + (edebug-Go-nonstop-mode . Go-nonstop)) "Association list between commands and the modes they set.") +(defvar edebug-mode-map) ; will be defined fully later. -'(defun edebug-set-initial-mode () - "Ask for the initial mode of the enclosing function. +(defun edebug-set-initial-mode () + "Set the initial execution mode of Edebug. The mode is requested via the key that would be used to set the mode in edebug-mode." (interactive) - (let* ((this-function (edebug-which-function)) - (keymap (if (eq edebug-mode-map (current-local-map)) - edebug-mode-map)) - (old-mode (or (get this-function 'edebug-initial-mode) - edebug-initial-mode)) + (let* ((old-mode edebug-initial-mode) (key (read-key-sequence (format - "Change initial edebug mode for %s from %s (%s) to (enter key): " - this-function - old-mode - (where-is-internal - (car (rassq old-mode edebug-initial-mode-alist)) - keymap 'firstonly - )))) - (mode (cdr (assq (key-binding key) edebug-initial-mode-alist))) - ) - (if (and mode - (or (get this-function 'edebug-initial-mode) - (not (eq mode edebug-initial-mode)))) + "Change initial edebug mode from %s (%c) to (enter key): " + old-mode + (aref (where-is-internal + (car (rassq old-mode edebug-initial-mode-alist)) + edebug-mode-map 'firstonly) + 0)))) + (mode (cdr (assq (lookup-key edebug-mode-map key) + edebug-initial-mode-alist)))) + (if mode (progn - (put this-function 'edebug-initial-mode mode) - (message "Initial mode for %s is now: %s" - this-function mode)) - (error "Key must map to one of the mode changing commands") - ))) + (setq edebug-initial-mode mode) + (message "Edebug's initial mode is now: %s" mode)) + (error "Key must map to one of the mode changing commands")))) ;;; Evaluation of expressions @@ -3425,7 +3413,9 @@ be installed in `emacs-lisp-mode-map'.") (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode) (define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode) (define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode) - (define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where)) + (define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where) + ;; The following isn't a GUD binding. + (define-key emacs-lisp-mode-map "\C-x\C-a\C-m" 'edebug-set-initial-mode)) (defvar edebug-mode-map (let ((map (copy-keymap emacs-lisp-mode-map))) @@ -3790,10 +3780,10 @@ Otherwise call `debug' normally." (if t (progn ;; Delete interspersed edebug internals. - (while (re-search-forward "^ \(?edebug" nil t) + (while (re-search-forward "^ (?edebug" nil t) (beginning-of-line) (cond - ((looking-at "^ \(edebug-after") + ((looking-at "^ (edebug-after") ;; Previous lines may contain code, so just delete this line. (setq last-ok-point (point)) (forward-line 1) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index a2f5f8af8ea..e3f7b11bb64 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -135,10 +135,10 @@ Currently under control of this var: (or (cl--find-class class) class) class)) -(defun class-p (class) - "Return non-nil if CLASS is a valid class vector. -CLASS is a symbol." ;FIXME: Is it a vector or a symbol? - (and (symbolp class) (eieio--class-p (cl--find-class class)))) +(defun class-p (x) + "Return non-nil if X is a valid class vector. +X can also be is a symbol." + (eieio--class-p (if (symbolp x) (cl--find-class x) x))) (defun eieio--class-print-name (class) "Return a printed representation of CLASS." @@ -769,7 +769,8 @@ Fills in OBJ's SLOT with its default value." (cl-check-type obj (or eieio-object class)) (cl-check-type slot symbol) (let* ((cl (cond ((symbolp obj) (cl--find-class obj)) - (t (eieio--object-class obj)))) + ((eieio-object-p obj) (eieio--object-class obj)) + (t obj))) (c (eieio--slot-name-index cl slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. @@ -850,7 +851,7 @@ Fills in the default value in CLASS' in SLOT with VALUE." ;; gnus/registry.el, so it might be used elsewhere as well, so let's ;; keep it for now. ;; FIXME: Generate a compile-time warning for it! - ;; (error "Can't ‘oset-default’ an instance-allocated slot: %S of %S" + ;; (error "Can't `oset-default' an instance-allocated slot: %S of %S" ;; slot class) (eieio--validate-slot-value class c value slot) ;; Set this into the storage for defaults. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index cae3fa2d460..f899f40fb80 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -137,7 +137,7 @@ the name of the test and the result of NAME-FORM." This effectively executes - \(apply (car COMMAND) (cdr COMMAND)\) + (apply (car COMMAND) (cdr COMMAND)) and returns the same value, but additionally runs hooks like `pre-command-hook' and `post-command-hook', and sets variables @@ -189,7 +189,7 @@ test for `called-interactively' in the command will fail." "Return a copy of S with all matches of REGEXPS removed. Elements of REGEXPS may also be two-element lists \(REGEXP -SUBEXP\), where SUBEXP is the number of a subexpression in +SUBEXP), where SUBEXP is the number of a subexpression in REGEXP. In that case, only that subexpression will be removed rather than the entire match." ;; Use a temporary buffer since replace-match copies strings, which @@ -215,7 +215,7 @@ property list, or no properties if there is no plist before it. As a simple example, \(ert-propertized-string \"foo \" \\='(face italic) \"bar\" \" baz\" nil \ -\" quux\"\) +\" quux\") would return the string \"foo bar baz quux\" where the substring \"bar baz\" has a `face' property with the value `italic'. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index d47e5d94b9d..2eba0216faf 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -187,7 +187,7 @@ using :expected-result. See `ert-test-result-type-p' for a description of valid values for RESULT-TYPE. \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \ -\[:tags '(TAG...)] BODY...)" +[:tags '(TAG...)] BODY...)" (declare (debug (&define :name test name sexp [&optional stringp] [&rest keywordp sexp] def-body)) @@ -887,10 +887,10 @@ Valid result types: nil -- Never matches. t -- Always matches. :failed, :passed, :skipped -- Matches corresponding results. -\(and TYPES...\) -- Matches if all TYPES match. -\(or TYPES...\) -- Matches if some TYPES match. -\(not TYPE\) -- Matches if TYPE does not match. -\(satisfies PREDICATE\) -- Matches if PREDICATE returns true when called with +\(and TYPES...) -- Matches if all TYPES match. +\(or TYPES...) -- Matches if some TYPES match. +\(not TYPE) -- Matches if TYPE does not match. +\(satisfies PREDICATE) -- Matches if PREDICATE returns true when called with RESULT." ;; It would be easy to add `member' and `eql' types etc., but I ;; haven't bothered yet. @@ -946,7 +946,7 @@ a test -- (i.e., an object of the ert-test data-type) Selects that test. a symbol -- Selects the test that the symbol names, errors if none. \(member TESTS...) -- Selects the elements of TESTS, a list of tests or symbols naming tests. -\(eql TEST\) -- Selects TEST, a test or a symbol naming a test. +\(eql TEST) -- Selects TEST, a test or a symbol naming a test. \(and SELECTORS...) -- Selects the tests that match all SELECTORS. \(or SELECTORS...) -- Selects the tests that match any of the SELECTORS. \(not SELECTOR) -- Selects all tests that do not match SELECTOR. diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 026a4a749a9..69d545560d4 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -62,7 +62,7 @@ ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\ foo\\|\\(?:[^icfgv]\\|g[^r]\\)\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\ menu-bar-make-toggle\\)" find-function-space-re - "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)") + "\\('\\|(quote \\)?%s\\(\\s-\\|$\\|[()]\\)") "The regexp used by `find-function' to search for a function definition. Note it must contain a `%s' at the place where `format' should insert the function name. The default value avoids `defconst', diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index bbe6b36ab9a..94fe6c3d441 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -233,7 +233,7 @@ turned into calls of the form (SETTER ARGS... VAL). If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and instead the assignment is turned into something equivalent to - \(let ((temp VAL)) + (let ((temp VAL)) (SETTER ARGS... temp) temp) so as to preserve the semantics of `setf'." diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 8aa34c7bef9..fec9467bbb7 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -28,6 +28,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defvar font-lock-comment-face) (defvar font-lock-doc-face) (defvar font-lock-keywords-case-fold-search) @@ -87,6 +89,9 @@ table) "Syntax table used in `lisp-mode'.") +(eval-and-compile + (defconst lisp-mode-symbol-regexp "\\(?:\\sw\\|\\s_\\|\\\\.\\)+")) + (defvar lisp-imenu-generic-expression (list (list nil @@ -110,7 +115,7 @@ ;; CLOS and EIEIO "defgeneric" "defmethod") t)) - "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)")) + "\\s-+\\(" lisp-mode-symbol-regexp "\\)")) 2) (list (purecopy "Variables") (purecopy (concat "^\\s-*(" @@ -122,11 +127,11 @@ "defconstant" "defparameter" "define-symbol-macro") t)) - "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)")) + "\\s-+\\(" lisp-mode-symbol-regexp "\\)")) 2) ;; For `defvar', we ignore (defvar FOO) constructs. (list (purecopy "Variables") - (purecopy (concat "^\\s-*(defvar\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" + (purecopy (concat "^\\s-*(defvar\\s-+\\(" lisp-mode-symbol-regexp "\\)" "[[:space:]\n]+[^)]")) 1) (list (purecopy "Types") @@ -143,7 +148,7 @@ ;; CLOS and EIEIO "defclass") t)) - "\\s-+'?\\(\\(\\sw\\|\\s_\\)+\\)")) + "\\s-+'?\\(" lisp-mode-symbol-regexp "\\)")) 2)) "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") @@ -220,7 +225,10 @@ (defun lisp--el-match-keyword (limit) ;; FIXME: Move to elisp-mode.el. (catch 'found - (while (re-search-forward "(\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" limit t) + (while (re-search-forward + (eval-when-compile + (concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>")) + limit t) (let ((sym (intern-soft (match-string 1)))) (when (or (special-form-p sym) (and (macrop sym) @@ -229,6 +237,19 @@ (match-beginning 0))))) (throw 'found t)))))) +(defmacro let-when-compile (bindings &rest body) + "Like `let', but allow for compile time optimization. +Use BINDINGS as in regular `let', but in BODY each usage should +be wrapped in `eval-when-compile'. +This will generate compile-time constants from BINDINGS." + (declare (indent 1) (debug let)) + (cl-progv (mapcar #'car bindings) + (mapcar (lambda (x) (eval (cadr x))) bindings) + (macroexpand-all + (macroexp-progn + body) + macroexpand-all-environment))) + (let-when-compile ((lisp-fdefs '("defmacro" "defun")) (lisp-vdefs '("defvar")) @@ -249,39 +270,13 @@ (el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local" "defface")) (el-tdefs '("defgroup" "deftheme")) - (el-kw '("while-no-input" "letrec" "pcase" "pcase-exhaustive" - "pcase-lambda" "pcase-let" "pcase-let*" "save-restriction" - "save-excursion" "save-selected-window" - ;; "eval-after-load" "eval-next-after-load" - "save-window-excursion" "save-current-buffer" - "save-match-data" "combine-after-change-calls" - "condition-case-unless-debug" "track-mouse" - "eval-and-compile" "eval-when-compile" "with-case-table" - "with-category-table" "with-coding-priority" - "with-current-buffer" "with-demoted-errors" - "with-electric-help" "with-eval-after-load" - "with-file-modes" - "with-local-quit" "with-no-warnings" - "with-output-to-temp-buffer" "with-selected-window" - "with-selected-frame" "with-silent-modifications" - "with-syntax-table" "with-temp-buffer" "with-temp-file" - "with-temp-message" "with-timeout" - "with-timeout-handler")) (el-errs '("user-error")) ;; Common-Lisp constructs supported by EIEIO. FIXME: namespace. (eieio-fdefs '("defgeneric" "defmethod")) (eieio-tdefs '("defclass")) - (eieio-kw '("with-slots")) ;; Common-Lisp constructs supported by cl-lib. - (cl-lib-fdefs '("defmacro" "defsubst" "defun" "defmethod")) + (cl-lib-fdefs '("defmacro" "defsubst" "defun" "defmethod" "defgeneric")) (cl-lib-tdefs '("defstruct" "deftype")) - (cl-lib-kw '("progv" "eval-when" "case" "ecase" "typecase" - "etypecase" "ccase" "ctypecase" "loop" "do" "do*" - "the" "locally" "proclaim" "declaim" "letf" "go" - ;; "lexical-let" "lexical-let*" - "symbol-macrolet" "flet" "flet*" "destructuring-bind" - "labels" "macrolet" "tagbody" "multiple-value-bind" - "block" "return" "return-from")) (cl-lib-errs '("assert" "check-type")) ;; Common-Lisp constructs not supported by cl-lib. (cl-fdefs '("defsetf" "define-method-combination" @@ -290,14 +285,20 @@ "define-compiler-macro" "define-modify-macro")) (cl-vdefs '("define-symbol-macro" "defconstant" "defparameter")) (cl-tdefs '("defpackage" "defstruct" "deftype")) - (cl-kw '("prog" "prog*" "handler-case" "handler-bind" - "in-package" "restart-case" ;; "inline" - "restart-bind" "break" "multiple-value-prog1" - "compiler-let" "with-accessors" "with-compilation-unit" + (cl-kw '("block" "break" "case" "ccase" "compiler-let" "ctypecase" + "declaim" "destructuring-bind" "do" "do*" + "ecase" "etypecase" "eval-when" "flet" "flet*" + "go" "handler-case" "handler-bind" "in-package" ;; "inline" + "labels" "letf" "locally" "loop" + "macrolet" "multiple-value-bind" "multiple-value-prog1" + "proclaim" "prog" "prog*" "progv" + "restart-case" "restart-bind" "return" "return-from" + "symbol-macrolet" "tagbody" "the" "typecase" + "with-accessors" "with-compilation-unit" "with-condition-restarts" "with-hash-table-iterator" "with-input-from-string" "with-open-file" "with-open-stream" "with-package-iterator" - "with-simple-restart" "with-standard-io-syntax")) + "with-simple-restart" "with-slots" "with-standard-io-syntax")) (cl-errs '("abort" "cerror"))) (let ((vdefs (eval-when-compile (append lisp-vdefs el-vdefs cl-vdefs))) @@ -318,16 +319,9 @@ eieio-fdefs eieio-tdefs cl-fdefs cl-vdefs cl-tdefs) t))) - ;; Elisp and Common Lisp keywords. - ;; (el-kws-re (eval-when-compile - ;; (regexp-opt (append - ;; lisp-kw el-kw eieio-kw - ;; (cons "go" (mapcar (lambda (s) (concat "cl-" s)) - ;; (remove "go" cl-lib-kw)))) - ;; t))) + ;; Common Lisp keywords (Elisp keywords are handled dynamically). (cl-kws-re (eval-when-compile - (regexp-opt (append lisp-kw cl-kw eieio-kw cl-lib-kw) - t))) + (regexp-opt (append lisp-kw cl-kw) t))) ;; Elisp and Common Lisp "errors". (el-errs-re (eval-when-compile (regexp-opt (append (mapcar (lambda (s) (concat "cl-" s)) @@ -349,7 +343,8 @@ ;; Any whitespace and defined object. "[ \t']*" "\\(([ \t']*\\)?" ;; An opening paren. - "\\(\\(setf\\)[ \t]+\\(?:\\sw\\|\\s_\\)+\\|\\(?:\\sw\\|\\s_\\)+\\)?") + "\\(\\(setf\\)[ \t]+" lisp-mode-symbol-regexp + "\\|" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (3 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type))) (cond ((eq type 'var) font-lock-variable-name-face) @@ -360,7 +355,8 @@ ;; defmethod with (setf foo) as name. ((or (not (match-string 2)) ;; Normal defun. (and (match-string 2) ;; Setf method. - (match-string 4))) font-lock-function-name-face))) + (match-string 4))) + font-lock-function-name-face))) nil t)) ;; Emacs Lisp autoload cookies. Supports the slightly different ;; forms used by mh-e, calendar, etc. @@ -373,7 +369,8 @@ ;; Any whitespace and defined object. "[ \t']*" "\\(([ \t']*\\)?" ;; An opening paren. - "\\(\\(setf\\)[ \t]+\\(?:\\sw\\|\\s_\\)+\\|\\(?:\\sw\\|\\s_\\)+\\)?") + "\\(\\(setf\\)[ \t]+" lisp-mode-symbol-regexp + "\\|" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (3 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type))) (cond ((eq type 'var) font-lock-variable-name-face) @@ -395,22 +392,25 @@ (lisp--el-match-keyword . 1) ;; Exit/Feature symbols as constants. (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\_>" - "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?") + "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) ;; Erroneous structures. (,(concat "(" el-errs-re "\\_>") (1 font-lock-warning-face)) ;; Words inside \\[] tend to be for `substitute-command-keys'. - ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]" + (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]") (1 font-lock-constant-face prepend)) ;; Words inside ‘’ and '' and `' tend to be symbol names. - ("['`‘]\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)['’]" + (,(concat "['`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" + lisp-mode-symbol-regexp "\\)['’]") (1 font-lock-constant-face prepend)) ;; Constant values. - ("\\_<:\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face) + (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") + (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - ("\\_<\\&\\(?:\\sw\\|\\s_\\)+\\_>" . font-lock-type-face) + (,(concat "\\_<\\&" lisp-mode-symbol-regexp "\\_>") + . font-lock-type-face) ;; ELisp regexp grouping constructs (,(lambda (bound) (catch 'found @@ -447,19 +447,22 @@ (,(concat "(" cl-kws-re "\\_>") . 1) ;; Exit/Feature symbols as constants. (,(concat "(\\(catch\\|throw\\|provide\\|require\\)\\_>" - "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?") + "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) ;; Erroneous structures. (,(concat "(" cl-errs-re "\\_>") (1 font-lock-warning-face)) ;; Words inside ‘’ and '' and `' tend to be symbol names. - ("['`‘]\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)['’]" + (,(concat "['`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" + lisp-mode-symbol-regexp "\\)['’]") (1 font-lock-constant-face prepend)) ;; Constant values. - ("\\_<:\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face) + (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") + (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - ("\\_<\\&\\(?:\\sw\\|\\s_\\)+\\_>" . font-lock-type-face) + (,(concat "\\_<\\&" lisp-mode-symbol-regexp "\\_>") + . font-lock-type-face) ;; This is too general -- rms. ;; A user complained that he has functions whose names start with `do' ;; and that they get the wrong color. @@ -482,7 +485,10 @@ (let* ((firstsym (and listbeg (save-excursion (goto-char listbeg) - (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)") + (and (looking-at + (eval-when-compile + (concat "([ \t\n]*\\(" + lisp-mode-symbol-regexp "\\)"))) (match-string 1))))) (docelt (and firstsym (function-get (intern-soft firstsym) @@ -898,7 +904,7 @@ 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 + (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 diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 7b7b48c66de..ca977db4b1d 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -364,8 +364,7 @@ is called as a function to find the defun's beginning." (arg-+ve (> arg 0))) (save-restriction (widen) - (let ((ppss (let (syntax-begin-function - font-lock-beginning-of-syntax-function) + (let ((ppss (let (syntax-begin-function) (syntax-ppss))) ;; position of least enclosing paren, or nil. encl-pos) diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index 43fd4ef57a6..b8fb540d6cb 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -44,7 +44,7 @@ Takes args PROMPTER ACTOR LIST, and optional args HELP and ACTION-ALIST. LIST is a list of objects, or a function of no arguments to return the next object or nil. -If PROMPTER is a string, the prompt is \(format PROMPTER OBJECT\). If not +If PROMPTER is a string, the prompt is \(format PROMPTER OBJECT). If not a string, PROMPTER is a function of one arg (an object from LIST), which returns a string to be used as the prompt for that object. If the return value is not a string, it may be nil to ignore the object or non-nil to act @@ -56,7 +56,7 @@ which gets called with each object that the user answers `yes' for. If HELP is given, it is a list (OBJECT OBJECTS ACTION), where OBJECT is a string giving the singular noun for an elt of LIST; OBJECTS is the plural noun for elts of LIST, and ACTION is a transitive -verb describing ACTOR. The default is \(\"object\" \"objects\" \"act on\"\). +verb describing ACTOR. The default is \(\"object\" \"objects\" \"act on\"). At the prompts, the user may enter y, Y, or SPC to act on that object; n, N, or DEL to skip that object; ! to act on all following objects; diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index b0d2ff96629..eb66e8f25a3 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1852,12 +1852,12 @@ add a call to it along with some explanatory comments." (save-restriction (widen) (goto-char (point-min)) - (search-forward "(package-initialize)" nil 'noerror)))) + (re-search-forward "(package-initialize\\_>" nil 'noerror)))) ;; Don't visit the file if we don't have to. (with-temp-buffer (insert-file-contents user-init-file) (goto-char (point-min)) - (search-forward "(package-initialize)" nil 'noerror))))) + (re-search-forward "(package-initialize\\_>" nil 'noerror))))) (unless contains-init (with-current-buffer (or buffer (let ((delay-mode-hooks t)) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index 9888e920219..e315733e222 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -143,7 +143,7 @@ If LAX non-nil, don't output parentheses if it doesn't require them. Merges keywords to avoid backtracking in Emacs's regexp matcher." ;; The basic idea is to find the shortest common prefix or suffix, remove it ;; and recurse. If there is no prefix, we divide the list into two so that - ;; \(at least) one half will have at least a one-character common prefix. + ;; (at least) one half will have at least a one-character common prefix. ;; Also we delay the addition of grouping parenthesis as long as possible ;; until we're sure we need them, and try to remove one-character sequences diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index a21ac7a2835..a5ff9722698 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -768,8 +768,8 @@ of all atomic regexps." ((= l 3) (string-match "\\`\\(?:\\\\[cCsS_]\\|\\[[^^]\\]\\)" r)) ((null lax) (cond - ((string-match "\\`\\[^?\]?\\(?:\\[:[a-z]+:]\\|[^\]]\\)*\\]\\'" r)) - ((string-match "\\`\\\\(\\(?:[^\\]\\|\\\\[^\)]\\)*\\\\)\\'" r))))))) + ((string-match "\\`\\[^?\]?\\(?:\\[:[a-z]+:]\\|[^]]\\)*\\]\\'" r)) + ((string-match "\\`\\\\(\\(?:[^\\]\\|\\\\[^)]\\)*\\\\)\\'" r))))))) (defun rx-syntax (form) diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 8dc91471312..e0f17c0335d 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -270,6 +270,19 @@ If so, return the non-nil value returned by PRED." (throw 'seq--break result)))) nil)) +(cl-defgeneric seq-find (pred seq &optional default) + "Return the first element for which (PRED element) is non-nil in SEQ. +If no element is found, return DEFAULT. + +Note that `seq-find' has an ambiguity if the found element is +identical to DEFAULT, as it cannot be known if an element was +found or not." + (catch 'seq--break + (seq-doseq (elt seq) + (when (funcall pred elt) + (throw 'seq--break elt))) + default)) + (cl-defgeneric seq-count (pred seq) "Return the number of elements for which (PRED element) is non-nil in SEQ." (let ((count 0)) @@ -417,13 +430,7 @@ If no element is found, return nil." (nreverse result))) (cl-defmethod seq-drop-while (pred (list list)) - "Optimized implementation of `seq-drop-while' for lists" - (while (and list (funcall pred (car list))) - (setq list (cdr list))) - list) - -(cl-defmethod seq-drop-while (pred (list list)) - "Optimized implementation of `seq-drop-while' for lists" + "Optimized implementation of `seq-drop-while' for lists." (while (and list (funcall pred (car list))) (setq list (cdr list))) list) diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index c7a95e4e5f3..17e3be7d3ff 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -68,9 +68,9 @@ This is slower, but filters out some innocuous shadowing." "Return a list of Emacs Lisp files that create shadows. This function does the work for `list-load-path-shadows'. -We traverse PATH looking for shadows, and return a \(possibly empty\) +We traverse PATH looking for shadows, and return a \(possibly empty) even-length list of files. A file in this list at position 2i shadows -the file in position 2i+1. Emacs Lisp file suffixes \(.el and .elc\) +the file in position 2i+1. Emacs Lisp file suffixes \(.el and .elc) are stripped from the file names in the list. See the documentation for `list-load-path-shadows' for further information." diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 0c24f796d19..f305025f215 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -213,7 +213,7 @@ one of those elements share the same precedence level and associativity." (defun smie-bnf->prec2 (bnf &rest resolvers) "Convert the BNF grammar into a prec2 table. BNF is a list of nonterminal definitions of the form: - \(NONTERM RHS1 RHS2 ...) + (NONTERM RHS1 RHS2 ...) where each RHS is a (non-empty) list of terminals (aka tokens) or non-terminals. Not all grammars are accepted: - an RHS cannot be an empty list (this is not needed, since SMIE allows all @@ -1136,6 +1136,8 @@ METHOD can be: - :elem, in which case the function should return either: - the offset to use to indent function arguments (ARG = `arg') - the basic indentation step (ARG = `basic'). + - the token to use (when ARG = `empty-line-token') when we don't know how + to indent an empty line. - :list-intro, in which case ARG is a token and the function should return non-nil if TOKEN is followed by a list of expressions (not separated by any token) rather than an expression. @@ -1686,6 +1688,19 @@ should not be computed on the basis of the following token." (+ (smie-indent-virtual) (smie-indent--offset 'basic))) ; (t (smie-indent-virtual)))))) ;An infix. +(defun smie-indent-empty-line () + "Indentation rule when there's nothing yet on the line." + ;; Without this rule, SMIE assumes that an empty line will be filled with an + ;; argument (since it falls back to smie-indent-sexps), which tends + ;; to indent far too deeply. + (when (eolp) + (let ((token (or (funcall smie-rules-function :elem 'empty-line-token) + ;; FIXME: Should we default to ";"? + ;; ";" + ))) + (when (assoc token smie-grammar) + (smie-indent-keyword token))))) + (defun smie-indent-exps () ;; Indentation of sequences of simple expressions without ;; intervening keywords or operators. E.g. "a b c" or "g (balbla) f". @@ -1744,7 +1759,7 @@ should not be computed on the basis of the following token." smie-indent-comment smie-indent-comment-continue smie-indent-comment-close smie-indent-comment-inside smie-indent-inside-string smie-indent-keyword smie-indent-after-keyword - smie-indent-exps) + smie-indent-empty-line smie-indent-exps) "Functions to compute the indentation. 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 diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 05dd7d57503..95ed775f6b4 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -43,8 +43,6 @@ (eval-when-compile (require 'cl-lib)) -(defvar font-lock-beginning-of-syntax-function) - ;;; Applying syntax-table properties where needed. (defvar syntax-propertize-function nil @@ -106,10 +104,6 @@ Put first the functions more likely to cause a change and cheaper to compute.") (point-max)))) (cons beg end)) -(defvar syntax-propertize--done -1 - "Position up to which syntax-table properties have been set.") -(make-variable-buffer-local 'syntax-propertize--done) - (defun syntax-propertize--shift-groups (re n) (replace-regexp-in-string "\\\\(\\?\\([0-9]+\\):" @@ -290,39 +284,59 @@ The return value is a function suitable for `syntax-propertize-function'." (defun syntax-propertize (pos) "Ensure that syntax-table properties are set until POS." - (when (and syntax-propertize-function - (< syntax-propertize--done pos)) - ;; (message "Needs to syntax-propertize from %s to %s" - ;; syntax-propertize--done pos) - (set (make-local-variable 'parse-sexp-lookup-properties) t) - (save-excursion - (with-silent-modifications - (let* ((start (max syntax-propertize--done (point-min))) - (end (max pos - (min (point-max) - (+ start syntax-propertize-chunk-size)))) - (funs syntax-propertize-extend-region-functions)) - (while funs - (let ((new (funcall (pop funs) start end))) - (if (or (null new) - (and (>= (car new) start) (<= (cdr new) end))) - nil - (setq start (car new)) - (setq end (cdr new)) - ;; If there's been a change, we should go through the - ;; list again since this new position may - ;; warrant a different answer from one of the funs we've - ;; already seen. - (unless (eq funs - (cdr syntax-propertize-extend-region-functions)) - (setq funs syntax-propertize-extend-region-functions))))) - ;; Move the limit before calling the function, so the function - ;; can use syntax-ppss. - (setq syntax-propertize--done end) - ;; (message "syntax-propertizing from %s to %s" start end) - (remove-text-properties start end - '(syntax-table nil syntax-multiline nil)) - (funcall syntax-propertize-function start end)))))) + (when (< syntax-propertize--done pos) + (if (null syntax-propertize-function) + (setq syntax-propertize--done (max (point-max) pos)) + ;; (message "Needs to syntax-propertize from %s to %s" + ;; syntax-propertize--done pos) + (set (make-local-variable 'parse-sexp-lookup-properties) t) + (save-excursion + (with-silent-modifications + (make-local-variable 'syntax-propertize--done) ;Just in case! + (let* ((start (max (min syntax-propertize--done (point-max)) + (point-min))) + (end (max pos + (min (point-max) + (+ start syntax-propertize-chunk-size)))) + (funs syntax-propertize-extend-region-functions)) + (while funs + (let ((new (funcall (pop funs) start end)) + ;; Avoid recursion! + (syntax-propertize--done most-positive-fixnum)) + (if (or (null new) + (and (>= (car new) start) (<= (cdr new) end))) + nil + (setq start (car new)) + (setq end (cdr new)) + ;; If there's been a change, we should go through the + ;; list again since this new position may + ;; warrant a different answer from one of the funs we've + ;; already seen. + (unless (eq funs + (cdr syntax-propertize-extend-region-functions)) + (setq funs syntax-propertize-extend-region-functions))))) + ;; Move the limit before calling the function, so the function + ;; can use syntax-ppss. + (setq syntax-propertize--done end) + ;; (message "syntax-propertizing from %s to %s" start end) + (remove-text-properties start end + '(syntax-table nil syntax-multiline nil)) + ;; Avoid recursion! + (let ((syntax-propertize--done most-positive-fixnum)) + (funcall syntax-propertize-function start end)))))))) + +;;; Link syntax-propertize with syntax.c. + +(defvar syntax-propertize-chunks + ;; We're not sure how far we'll go. In my tests, using chunks of 20000 + ;; brings to overhead to something negligible. Passing ‘charpos’ directly + ;; also works (basically works line-by-line) but results in an overhead which + ;; I thought was a bit too high (like around 50%). + 2000) + +(defun internal--syntax-propertize (charpos) + ;; FIXME: Called directly from C. + (syntax-propertize (min (+ syntax-propertize-chunks charpos) (point-max)))) ;;; Incrementally compute and memoize parser state. @@ -360,6 +374,7 @@ from each other, to avoid keeping too much useless info.") "Function to move back outside of any comment/string/paren. This function should move the cursor back to some syntactically safe point (where the PPSS is equivalent to nil).") +(make-obsolete-variable 'syntax-begin-function nil "25.1") (defvar syntax-ppss-cache nil "List of (POS . PPSS) pairs, in decreasing POS order.") @@ -487,11 +502,6 @@ running the hook." ;; - The function might be slow. ;; - If this function almost always finds a safe nearby spot, ;; the cache won't be populated, so consulting it is cheap. - (when (and (not syntax-begin-function) - (boundp 'font-lock-beginning-of-syntax-function) - font-lock-beginning-of-syntax-function) - (set (make-local-variable 'syntax-begin-function) - font-lock-beginning-of-syntax-function)) (when (and syntax-begin-function (progn (goto-char pos) (funcall syntax-begin-function) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index dca459f2bf6..c9e3fbe4f7d 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -205,7 +205,7 @@ timers). If nil, allocate a new cell." "Insert TIMER into `timer-idle-list'. This arranges to activate TIMER whenever Emacs is next idle. If optional argument DONT-WAIT is non-nil, set TIMER to activate -immediately \(see below\), or at the right time, if Emacs is +immediately \(see below), or at the right time, if Emacs is already idle. REUSE-CELL, if non-nil, is a cons cell to reuse when inserting @@ -345,18 +345,26 @@ This function is called, by name, directly by the C code." (defun run-at-time (time repeat function &rest args) "Perform an action at time TIME. Repeat the action every REPEAT seconds, if REPEAT is non-nil. -TIME should be one of: a string giving an absolute time like -\"11:23pm\" (the acceptable formats are those recognized by -`diary-entry-time'; note that such times are interpreted as times -today, even if in the past); a string giving a relative time like -\"2 hours 35 minutes\" (the acceptable formats are those -recognized by `timer-duration'); nil meaning now; a number of -seconds from now; a value from `encode-time'; or t (with non-nil -REPEAT) meaning the next integral multiple of REPEAT. REPEAT may -be an integer or floating point number. The action is to call -FUNCTION with arguments ARGS. +REPEAT may be an integer or floating point number. +TIME should be one of: +- a string giving today's time like \"11:23pm\" + (the acceptable formats are HHMM, H:MM, HH:MM, HHam, HHAM, + HHpm, HHPM, HH:MMam, HH:MMAM, HH:MMpm, or HH:MMPM; + a period `.' can be used instead of a colon `:' to separate + the hour and minute parts); +- a string giving a relative time like \"90\" or \"2 hours 35 minutes\" + (the acceptable forms are a number of seconds without units + or some combination of values using units in `timer-duration-words'); +- nil, meaning now; +- a number of seconds from now; +- a value from `encode-time'; +- or t (with non-nil REPEAT) meaning the next integral + multiple of REPEAT. -This function returns a timer object which you can use in `cancel-timer'." +The action is to call FUNCTION with arguments ARGS. + +This function returns a timer object which you can use in +`cancel-timer'." (interactive "sRun at time: \nNRepeat interval: \naFunction: ") (or (null repeat) |
