diff options
| author | Wilson Snyder <wsnyder@wsnyder.org> | 2019-05-06 18:35:59 -0400 |
|---|---|---|
| committer | Wilson Snyder <wsnyder@wsnyder.org> | 2019-05-06 18:35:59 -0400 |
| commit | 921d279e15256a07168033b0c50f1fc82e22ef7f (patch) | |
| tree | e048888bb4983009668a594f6ba83e3baa1b6ea3 | |
| parent | 01963fbbe10d290ba037cd523d21ebbcd2536b40 (diff) | |
| parent | 6fa99f06b92b593082d7181ba59ab7eebda45f81 (diff) | |
| download | emacs-921d279e15256a07168033b0c50f1fc82e22ef7f.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
| -rw-r--r-- | lisp/custom.el | 21 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 21 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 3 | ||||
| -rw-r--r-- | lisp/term.el | 6 | ||||
| -rw-r--r-- | src/eval.c | 50 | ||||
| -rw-r--r-- | src/insdel.c | 13 |
6 files changed, 70 insertions, 44 deletions
diff --git a/lisp/custom.el b/lisp/custom.el index 53b8045f058..29bf9e570a8 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -56,8 +56,14 @@ Otherwise, if symbol has a `saved-value' property, it will evaluate the car of that and use it as the default binding for symbol. Otherwise, EXP will be evaluated and used as the default binding for symbol." - (eval `(defvar ,symbol ,(let ((sv (get symbol 'saved-value))) - (if sv (car sv) exp))))) + (condition-case nil + (default-toplevel-value symbol) ;Test presence of default value. + (void-variable + ;; The var is not initialized yet. + (set-default-toplevel-value + symbol (eval (let ((sv (get symbol 'saved-value))) + (if sv (car sv) exp)) + t))))) (defun custom-initialize-set (symbol exp) "Initialize SYMBOL based on EXP. @@ -188,18 +194,13 @@ set to nil, as the value is no longer rogue." (t (custom-handle-keyword symbol keyword value 'custom-variable)))))) + ;; Set the docstring, record the var on load-history, as well + ;; as set the special-variable-p flag. + (internal--define-uninitialized-variable symbol doc) (put symbol 'custom-requests requests) ;; Do the actual initialization. (unless custom-dont-initialize (funcall initialize symbol default))) - ;; Use defvar to set the docstring as well as the special-variable-p flag. - ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning - ;; when the var is currently let-bound. - (if (not (default-boundp symbol)) - ;; Don't use defvar to avoid setting a default-value when undesired. - (when doc (put symbol 'variable-documentation doc)) - (eval `(defvar ,symbol nil ,@(when doc (list doc))))) - (push symbol current-load-list) (run-hooks 'custom-define-hook) symbol) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index f73dbb269d8..38df920f17a 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -645,14 +645,8 @@ Interactively, the behavior depends on `narrow-to-defun-include-comments'." (re-search-backward "^\n" (- (point) 1) t) (narrow-to-region beg end)))) -(defvar insert-pair-alist - (append '((?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) - (let (alist) - (map-char-table - (lambda (open close) - (when (< open close) (push (list open close) alist))) - (unicode-property-table-internal 'paired-bracket)) - (nreverse alist))) +(defcustom insert-pair-alist + '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) "Alist of paired characters inserted by `insert-pair'. Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR OPEN-CHAR CLOSE-CHAR). The characters OPEN-CHAR and CLOSE-CHAR @@ -661,7 +655,16 @@ or without modifiers, are inserted by `insert-pair'. If COMMAND-CHAR is specified, it is a character that triggers the insertion of the open/close pair, and COMMAND-CHAR itself isn't -inserted.") +inserted." + :type '(repeat (choice (list :tag "Pair" + (character :tag "Open") + (character :tag "Close")) + (list :tag "Triple" + (character :tag "Command") + (character :tag "Open") + (character :tag "Close")))) + :group 'lisp + :version "27.1") (defun insert-pair (&optional arg open close) "Enclose following ARG sexps in a pair of OPEN and CLOSE characters. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 7e6a46ea6e0..a2762ca2097 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1143,6 +1143,9 @@ comment at the start of cc-engine.el for more info." ;; Have we moved into a macro? ((and (not macro-start) (c-beginning-of-macro)) + (save-excursion + (c-backward-syntactic-ws) + (setq before-sws-pos (point))) ;; Have we crossed a statement boundary? If not, ;; keep going back until we find one or a "real" sexp. (and diff --git a/lisp/term.el b/lisp/term.el index 586a887a29f..283e5684b72 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2935,7 +2935,8 @@ See `term-prompt-regexp'." (delete-region (point) (line-end-position)) (term-down 1 t) (term-move-columns (- (term-current-column))) - (put-text-property (1- (point)) (point) 'term-line-wrap t) + (add-text-properties (1- (point)) (point) + '(term-line-wrap t rear-nonsticky t)) (setq decoded-substring (substring decoded-substring (- term-width old-column))) (setq old-column 0))) @@ -3754,7 +3755,8 @@ all pending output has been dealt with.")) (when (not (bolp)) (let ((old-point (point))) (insert-before-markers ?\n) - (put-text-property old-point (point) 'term-line-wrap t)))) + (add-text-properties old-point (point) + '(term-line-wrap t rear-nonsticky t))))) (defun term-erase-in-line (kind) (when (= kind 1) ;; erase left of point diff --git a/src/eval.c b/src/eval.c index 3fd9a40a3a2..567c32e0d75 100644 --- a/src/eval.c +++ b/src/eval.c @@ -715,6 +715,25 @@ DEFUN ("set-default-toplevel-value", Fset_default_toplevel_value, return Qnil; } +DEFUN ("internal--define-uninitialized-variable", + Finternal__define_uninitialized_variable, + Sinternal__define_uninitialized_variable, 1, 2, 0, + doc: /* Define SYMBOL as a variable, with DOC as its docstring. +This is like `defvar' and `defconst' but without affecting the variable's +value. */) + (Lisp_Object symbol, Lisp_Object doc) +{ + XSYMBOL (symbol)->u.s.declared_special = true; + if (!NILP (doc)) + { + if (!NILP (Vpurify_flag)) + doc = Fpurecopy (doc); + Fput (symbol, Qvariable_documentation, doc); + } + LOADHIST_ATTACH (symbol); + return Qnil; +} + DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, doc: /* Define SYMBOL as a variable, and return SYMBOL. You are not required to define a variable in order to use it, but @@ -754,32 +773,25 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) { if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) error ("Too many arguments"); + Lisp_Object exp = XCAR (tail); tem = Fdefault_boundp (sym); + tail = XCDR (tail); /* Do it before evaluating the initial value, for self-references. */ - XSYMBOL (sym)->u.s.declared_special = true; + Finternal__define_uninitialized_variable (sym, CAR (tail)); if (NILP (tem)) - Fset_default (sym, eval_sub (XCAR (tail))); + Fset_default (sym, eval_sub (exp)); else { /* Check if there is really a global binding rather than just a let binding that shadows the global unboundness of the var. */ union specbinding *binding = default_toplevel_binding (sym); if (binding && EQ (specpdl_old_value (binding), Qunbound)) { - set_specpdl_old_value (binding, eval_sub (XCAR (tail))); + set_specpdl_old_value (binding, eval_sub (exp)); } } - tail = XCDR (tail); - tem = Fcar (tail); - if (!NILP (tem)) - { - if (!NILP (Vpurify_flag)) - tem = Fpurecopy (tem); - Fput (sym, Qvariable_documentation, tem); - } - LOADHIST_ATTACH (sym); } else if (!NILP (Vinternal_interpreter_environment) && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special)) @@ -827,19 +839,12 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) docstring = XCAR (XCDR (XCDR (args))); } + Finternal__define_uninitialized_variable (sym, docstring); tem = eval_sub (XCAR (XCDR (args))); if (!NILP (Vpurify_flag)) tem = Fpurecopy (tem); - Fset_default (sym, tem); - XSYMBOL (sym)->u.s.declared_special = true; - if (!NILP (docstring)) - { - if (!NILP (Vpurify_flag)) - docstring = Fpurecopy (docstring); - Fput (sym, Qvariable_documentation, docstring); - } - Fput (sym, Qrisky_local_variable, Qt); - LOADHIST_ATTACH (sym); + Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */ + Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */ return sym; } @@ -4198,6 +4203,7 @@ alist of active lexical bindings. */); defsubr (&Sdefvaralias); DEFSYM (Qdefvaralias, "defvaralias"); defsubr (&Sdefconst); + defsubr (&Sinternal__define_uninitialized_variable); defsubr (&Smake_var_non_special); defsubr (&Slet); defsubr (&SletX); diff --git a/src/insdel.c b/src/insdel.c index 1231bb2682b..85fffd8fd16 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2178,6 +2178,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) { ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; + Lisp_Object tmp; if (inhibit_modification_hooks) return; @@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) and there are no before-change functions, just record the args that we were going to use. */ if (! NILP (Vcombine_after_change_calls) - && NILP (Vbefore_change_functions) + /* It's OK to defer after-changes even if syntax-ppss-flush-cache + * is on before-change-functions, which is common enough to be worth + * adding a special case for it. */ + && (NILP (Vbefore_change_functions) + || (CONSP (Vbefore_change_functions) + && EQ (Qt, XCAR (Vbefore_change_functions)) + && NILP (Fdefault_value (Qbefore_change_functions)) + && CONSP (tmp = XCDR (Vbefore_change_functions)) + && NILP (XCDR (tmp)) + && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache))) && !buffer_has_overlays ()) { Lisp_Object elt; @@ -2343,6 +2353,7 @@ syms_of_insdel (void) combine_after_change_buffer = Qnil; DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); + DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache"); DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the function `combine-after-change-calls' macro. */); |
