aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2019-05-14 17:18:18 -0700
committerGlenn Morris2019-05-14 17:18:18 -0700
commit5fe9375a5164960c3ecb65a7ef6d742069b8a7d7 (patch)
tree315715009d9fe5af40be38cb0dfccecfaf4c5528 /lisp
parent0f63e17663f99742425c9ec4f282f5e7e3194b1b (diff)
parent02bee7860f7e650ef13e00fe1a7f9a362e3eb001 (diff)
downloademacs-5fe9375a5164960c3ecb65a7ef6d742069b8a7d7.tar.gz
emacs-5fe9375a5164960c3ecb65a7ef6d742069b8a7d7.zip
Merge from origin/emacs-26
02bee78 Let dir locals for more specific modes override those from less b1235f9 Improve documentation of Hexl mode 32d1813 Fix description of (move-to-column <n> t) when column <n> is ... 0397b7c ; Fix smtpmail-stream-type docstring 7dab3ee Recognize single quote attribute values in nxml and sgml (Bug... e4cde42 Disable extra display of &#10; in nxml-mode (Bug#32897) ca14dd1 Fix nxml-get-inside (Bug#32003) e7ab351 Fix positioning client buffer as instructed by emacsclient # Conflicts: # lisp/files.el # lisp/textmodes/sgml-mode.el
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el47
-rw-r--r--lisp/mail/smtpmail.el6
-rw-r--r--lisp/nxml/nxml-mode.el4
-rw-r--r--lisp/nxml/nxml-rap.el42
-rw-r--r--lisp/server.el9
-rw-r--r--lisp/textmodes/sgml-mode.el47
6 files changed, 98 insertions, 57 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 8477c227bcc..8fa7f16de01 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4110,6 +4110,52 @@ This function returns either:
4110(declare-function map-merge-with "map" (type function &rest maps)) 4110(declare-function map-merge-with "map" (type function &rest maps))
4111(declare-function map-merge "map" (type &rest maps)) 4111(declare-function map-merge "map" (type &rest maps))
4112 4112
4113(defun dir-locals--get-sort-score (node)
4114 "Return a number used for sorting the definitions of dir locals.
4115NODE is assumed to be a cons cell where the car is either a
4116string or a symbol representing a mode name.
4117
4118If it is a mode then the the depth of the mode (ie, how many
4119parents that mode has) will be returned.
4120
4121If it is a string then the length of the string plus 1000 will be
4122returned.
4123
4124Otherwise it returns -1.
4125
4126That way the value can be used to sort the list such that deeper
4127modes will be after the other modes. This will be followed by
4128directory entries in order of length. If the entries are all
4129applied in order then that means the more specific modes will
4130 override the values specified by the earlier modes and directory
4131variables will override modes."
4132 (let ((key (car node)))
4133 (cond ((null key) -1)
4134 ((symbolp key)
4135 (let ((mode key)
4136 (depth 0))
4137 (while (setq mode (get mode 'derived-mode-parent))
4138 (setq depth (1+ depth)))
4139 depth))
4140 ((stringp key)
4141 (+ 1000 (length key)))
4142 (t -2))))
4143
4144(defun dir-locals--sort-variables (variables)
4145 "Sorts VARIABLES so that applying them in order has the right effect.
4146The variables are compared by dir-locals--get-sort-score.
4147Directory entries are then recursively sorted using the same
4148criteria."
4149 (setq variables (sort variables
4150 (lambda (a b)
4151 (< (dir-locals--get-sort-score a)
4152 (dir-locals--get-sort-score b)))))
4153 (dolist (n variables)
4154 (when (stringp (car n))
4155 (setcdr n (dir-locals--sort-variables (cdr n)))))
4156
4157 variables)
4158
4113(defun dir-locals-read-from-dir (dir) 4159(defun dir-locals-read-from-dir (dir)
4114 "Load all variables files in DIR and register a new class and instance. 4160 "Load all variables files in DIR and register a new class and instance.
4115DIR is the absolute name of a directory which must contain at 4161DIR is the absolute name of a directory which must contain at
@@ -4147,6 +4193,7 @@ Return the new class name, which is a symbol named DIR."
4147 variables 4193 variables
4148 newvars)))))) 4194 newvars))))))
4149 (setq success latest)) 4195 (setq success latest))
4196 (setq variables (dir-locals--sort-variables variables))
4150 (dir-locals-set-class-variables class-name variables) 4197 (dir-locals-set-class-variables class-name variables)
4151 (dir-locals-set-directory-class dir class-name success) 4198 (dir-locals-set-directory-class dir class-name success)
4152 class-name)) 4199 class-name))
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f31e0b45d20..05ef29a1141 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -101,9 +101,9 @@ don't define this value."
101 101
102(defcustom smtpmail-stream-type nil 102(defcustom smtpmail-stream-type nil
103 "Type of SMTP connections to use. 103 "Type of SMTP connections to use.
104This may be either nil (possibly upgraded to STARTTLS if possible), 104This may be either nil (upgrade with STARTTLS if possible),
105or `starttls' (refuse to send if STARTTLS isn't available), or `plain' 105`starttls' (refuse to send if STARTTLS isn't available),
106\(never use STARTTLS), or `ssl' (to use TLS/SSL)." 106`plain' (never use STARTTLS), or `ssl' (to use TLS/SSL)."
107 :version "24.1" 107 :version "24.1"
108 :group 'smtpmail 108 :group 'smtpmail
109 :type '(choice (const :tag "Possibly upgrade to STARTTLS" nil) 109 :type '(choice (const :tag "Possibly upgrade to STARTTLS" nil)
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 6f80912dd58..8da9f5ca287 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -2379,7 +2379,9 @@ With a prefix argument, inserts the character directly."
2379(put 'nxml-char-ref 'evaporate t) 2379(put 'nxml-char-ref 'evaporate t)
2380 2380
2381(defun nxml-char-ref-display-extra (start end n) 2381(defun nxml-char-ref-display-extra (start end n)
2382 (when nxml-char-ref-extra-display 2382 (when (and ;; Displaying literal newline is unhelpful.
2383 (not (eql n ?\n))
2384 nxml-char-ref-extra-display)
2383 (let ((name (or (get-char-code-property n 'name) 2385 (let ((name (or (get-char-code-property n 'name)
2384 (get-char-code-property n 'old-name))) 2386 (get-char-code-property n 'old-name)))
2385 (glyph-string (and nxml-char-ref-display-glyph-flag 2387 (glyph-string (and nxml-char-ref-display-glyph-flag
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 2bd758be3a5..21dbaded25a 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -35,35 +35,25 @@
35;; 35;;
36;; Our strategy is to keep track of just the problematic things. 36;; Our strategy is to keep track of just the problematic things.
37;; Specifically, we keep track of all comments, CDATA sections and 37;; Specifically, we keep track of all comments, CDATA sections and
38;; processing instructions in the instance. We do this by marking all 38;; processing instructions in the instance. We do this by marking
39;; except the first character of these with a non-nil nxml-inside text 39;; the first character of these with the generic string syntax by setting
40;; property. The value of the nxml-inside property is comment, 40;; a 'syntax-table' text property in `sgml-syntax-propertize'.
41;; cdata-section or processing-instruction. The first character does
42;; not have the nxml-inside property so we can find the beginning of
43;; the construct by looking for a change in a text property value
44;; (Emacs provides primitives for this). We use text properties
45;; rather than overlays, since the implementation of overlays doesn't
46;; look like it scales to large numbers of overlays in a buffer.
47;;
48;; We don't in fact track all these constructs, but only track them in
49;; some initial part of the instance.
50;; 41;;
51;; Thus to parse some random point in the file we first ensure that we 42;; Thus to parse some random point in the file we first ensure that we
52;; have scanned up to that point. Then we search backwards for a 43;; have scanned up to that point. Then we search backwards for a <.
53;; <. Then we check whether the < has an nxml-inside property. If it 44;; Then we check whether the < has the generic string syntax. If it
54;; does we go backwards to first character that does not have an 45;; does we go backwards to first character of the generic string (this
55;; nxml-inside property (this character must be a <). Then we start 46;; character must be a <). Then we start parsing forward from the <
56;; parsing forward from the < we have found. 47;; we have found.
57;; 48;;
58;; The prolog has to be parsed specially, so we also keep track of the 49;; The prolog has to be parsed specially, so we also keep track of the
59;; end of the prolog in `nxml-prolog-end'. The prolog is reparsed on 50;; end of the prolog in `nxml-prolog-end'. The prolog is reparsed on
60;; every change to the prolog. This won't work well if people try to 51;; every change to the prolog. This won't work well if people try to
61;; edit huge internal subsets. Hopefully that will be rare. 52;; edit huge internal subsets. Hopefully that will be rare.
62;; 53;;
63;; We keep track of the changes by adding to the buffer's 54;; We rely on the `syntax-propertize-function' machinery to keep track
64;; after-change-functions hook. Scanning is also done as a 55;; of the changes in the buffer. Fontification also relies on correct
65;; prerequisite to fontification by adding to fontification-functions 56;; `syntax-table' properties. This means that scanning for these
66;; (in the same way as jit-lock). This means that scanning for these
67;; constructs had better be quick. Fortunately it is. Firstly, the 57;; constructs had better be quick. Fortunately it is. Firstly, the
68;; typical proportion of comments, CDATA sections and processing 58;; typical proportion of comments, CDATA sections and processing
69;; instructions is small relative to other things. Secondly, to scan 59;; instructions is small relative to other things. Secondly, to scan
@@ -79,7 +69,15 @@
79 "Integer giving position following end of the prolog.") 69 "Integer giving position following end of the prolog.")
80 70
81(defsubst nxml-get-inside (pos) 71(defsubst nxml-get-inside (pos)
82 (save-excursion (nth 8 (syntax-ppss pos)))) 72 "Return non-nil if inside comment, CDATA, or PI."
73 (let ((ppss (save-excursion (syntax-ppss pos))))
74 (or
75 ;; Inside comment.
76 (nth 4 ppss)
77 ;; Inside "generic" string which is used for CDATA, and PI.
78 ;; "Normal" double and single quoted strings are used for
79 ;; attribute values.
80 (eq t (nth 3 ppss)))))
83 81
84(defun nxml-inside-end (pos) 82(defun nxml-inside-end (pos)
85 "Return the end of the inside region containing POS. 83 "Return the end of the inside region containing POS.
diff --git a/lisp/server.el b/lisp/server.el
index d8c7c313ef1..436a44a7e94 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1650,7 +1650,14 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
1650 (frame-terminal)))) 1650 (frame-terminal))))
1651 'nomini 'visible (selected-window)))) 1651 'nomini 'visible (selected-window))))
1652 (condition-case nil 1652 (condition-case nil
1653 (switch-to-buffer next-buffer) 1653 ;; If the client specified a new buffer position,
1654 ;; treat that as an explicit point-move command, and
1655 ;; override switch-to-buffer-preserve-window-point.
1656 (let ((switch-to-buffer-preserve-window-point
1657 (if filepos
1658 nil
1659 switch-to-buffer-preserve-window-point)))
1660 (switch-to-buffer next-buffer))
1654 ;; After all the above, we might still have ended up with 1661 ;; After all the above, we might still have ended up with
1655 ;; a minibuffer/dedicated-window (if there's no other). 1662 ;; a minibuffer/dedicated-window (if there's no other).
1656 (error (pop-to-buffer next-buffer))))))) 1663 (error (pop-to-buffer next-buffer)))))))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 9e3be99af14..6dc1b9e727e 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -96,24 +96,20 @@ a DOCTYPE or an XML declaration."
96`text-mode-hook' is run first." 96`text-mode-hook' is run first."
97 :type 'hook) 97 :type 'hook)
98 98
99;; As long as Emacs's syntax can't be complemented with predicates to context 99;; The official handling of "--" is complicated in SGML, and
100;; sensitively confirm the syntax of characters, we have to live with this 100;; historically not well supported by browser HTML parsers.
101;; kludgy kind of tradeoff. 101;; Recommendations for writing HTML comments is to use <!--...-->
102(defvar sgml-specials '(?\") 102;; (where ... doesn't contain "--") to avoid the complications
103;; altogether (XML goes even further by requiring this in the spec).
104;; So there is probably no need to handle it "correctly".
105(defvar sgml-specials '(?\" ?\')
103 "List of characters that have a special meaning for SGML mode. 106 "List of characters that have a special meaning for SGML mode.
104This list is used when first loading the `sgml-mode' library. 107This list is used when first loading the `sgml-mode' library.
105The supported characters and potential disadvantages are: 108The supported characters are ?\\\", ?\\=', and ?-.
106 109
107 ?\\\" Makes \" in text start a string. 110Including ?- makes double dashes into comment delimiters, but
108 ?\\=' Makes \\=' in text start a string. 111they are really only supposed to delimit comments within DTD
109 ?- Makes -- in text start a comment. 112definitions. So we normally turn it off.")
110
111When only one of ?\\\" or ?\\=' are included, \"\\='\" or \\='\"\\=', as can be found in
112DTDs, start a string. To partially avoid this problem this also makes these
113self insert as named entities depending on `sgml-quick-keys'.
114
115Including ?- has the problem of affecting dashes that have nothing to do
116with comments, so we normally turn it off.")
117 113
118(defvar sgml-quick-keys nil 114(defvar sgml-quick-keys nil
119 "Use <, >, &, /, SPC and `sgml-specials' keys \"electrically\" when non-nil. 115 "Use <, >, &, /, SPC and `sgml-specials' keys \"electrically\" when non-nil.
@@ -343,21 +339,12 @@ Any terminating `>' or `/' is not matched.")
343 ("--[ \t\n]*\\(>\\)" (1 "> b")) 339 ("--[ \t\n]*\\(>\\)" (1 "> b"))
344 ("\\(<\\)[?!]" (1 (prog1 "|>" 340 ("\\(<\\)[?!]" (1 (prog1 "|>"
345 (sgml-syntax-propertize-inside end)))) 341 (sgml-syntax-propertize-inside end))))
346 ;; Double quotes outside of tags should not introduce strings which end up 342 ;; Quotes outside of tags should not introduce strings.
347 ;; hiding tags. We used to test every double quote and mark it as "." 343 ;; Be careful to call `syntax-ppss' on a position before the one we're
348 ;; if it's outside of tags, but there are too many double quotes and 344 ;; going to change, so as not to need to flush the data we just computed.
349 ;; the resulting number of calls to syntax-ppss made it too slow 345 ("[\"']" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
350 ;; (bug#33887), so we're now careful to leave alone any pair 346 (goto-char (match-end 0)))
351 ;; of quotes that doesn't hold a < or > char, which is the vast majority. 347 (string-to-syntax ".")))))))
352 ("\\(\"\\)[^\"<>]*[<>\"]"
353 (1 (unless (eq ?\" (char-before))
354 ;; Be careful to call `syntax-ppss' on a position before the one
355 ;; we're going to change, so as not to need to flush the data we
356 ;; just computed.
357 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
358 (goto-char (1- (match-end 0))))
359 (string-to-syntax ".")))))
360 )))
361 348
362(defun sgml-syntax-propertize (start end) 349(defun sgml-syntax-propertize (start end)
363 "Syntactic keywords for `sgml-mode'." 350 "Syntactic keywords for `sgml-mode'."