diff options
author | Vibhav Pant <vibhavp@gmail.com> | 2017-02-13 17:07:36 +0530 |
---|---|---|
committer | Vibhav Pant <vibhavp@gmail.com> | 2017-02-13 17:07:36 +0530 |
commit | cb410433e069b5bb450193353c3fea8593a643a9 (patch) | |
tree | d2f4269781b4841e5a0c27ec57a5a4fbcec386c0 | |
parent | e742450427007cdde242c11380dfe32a950fab61 (diff) | |
parent | 4b18ef7ba3dd8aae4f3c3bf931365ef7da883baf (diff) | |
download | emacs-feature/byte-switch.tar.gz |
Merge branch 'master' into feature/byte-switchfeature/byte-switch
-rw-r--r-- | doc/lispref/os.texi | 4 | ||||
-rw-r--r-- | lisp/allout.el | 5 | ||||
-rw-r--r-- | lisp/bookmark.el | 8 | ||||
-rw-r--r-- | lisp/buff-menu.el | 2 | ||||
-rw-r--r-- | lisp/cus-edit.el | 4 | ||||
-rw-r--r-- | lisp/cus-theme.el | 4 | ||||
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 16 | ||||
-rw-r--r-- | lisp/emacs-lisp/elint.el | 2 | ||||
-rw-r--r-- | lisp/emulation/viper-cmd.el | 2 | ||||
-rw-r--r-- | lisp/gnus/mm-bodies.el | 22 | ||||
-rw-r--r-- | lisp/image-dired.el | 4 | ||||
-rw-r--r-- | lisp/international/mule-util.el | 10 | ||||
-rw-r--r-- | lisp/net/tramp.el | 25 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 43 | ||||
-rw-r--r-- | lisp/progmodes/vhdl-mode.el | 3 | ||||
-rw-r--r-- | lisp/replace.el | 40 | ||||
-rw-r--r-- | lisp/server.el | 4 | ||||
-rw-r--r-- | lisp/simple.el | 2 | ||||
-rw-r--r-- | lisp/startup.el | 5 | ||||
-rw-r--r-- | lisp/subr.el | 8 | ||||
-rw-r--r-- | lisp/textmodes/css-mode.el | 6 | ||||
-rw-r--r-- | lisp/time-stamp.el | 13 | ||||
-rw-r--r-- | lisp/xdg.el | 11 | ||||
-rw-r--r-- | test/lisp/progmodes/js-tests.el | 17 | ||||
-rw-r--r-- | test/lisp/textmodes/css-mode-tests.el | 3 | ||||
-rw-r--r-- | test/src/fns-tests.el | 18 |
28 files changed, 158 insertions, 127 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 553bb4a0068..178822b311e 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -940,9 +940,7 @@ string. If this variable is non-@code{nil}, it is used instead of @code{system-name} for purposes of generating email addresses. For example, it is used when constructing the default value of -@code{user-mail-address}. @xref{User Identification}. (Since this is -done when Emacs starts up, the value actually used is the one saved when -Emacs was dumped. @xref{Building Emacs}.) +@code{user-mail-address}. @xref{User Identification}. @c FIXME sounds like should probably give this a :set-after and some @c custom-initialize-delay voodoo. @end defopt diff --git a/lisp/allout.el b/lisp/allout.el index 4a0aeeedf6a..e837f83ed38 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -4462,7 +4462,7 @@ Topic exposure is marked with text-properties, to be used by (if (and (/= (current-column) 0) (not (eobp))) (forward-char 1)) (if (not (eobp)) - (if (and (save-match-data (looking-at "\n")) + (if (and (= (following-char) ?\n) (or (save-excursion (or (not (allout-next-heading)) (= depth allout-recent-depth))) @@ -6278,8 +6278,7 @@ It must also have content." (setq got nil done t) (goto-char (setq got (match-beginning 0))) - (if (save-match-data (looking-at "\n")) - (forward-char 1)) + (when (= (following-char) ?\n) (forward-char 1)) (setq got (point))) (cond ((not got) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 02dd8a9f6fc..5b8ded7b22a 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -896,8 +896,8 @@ If optional arg NEWLINE-TOO is non-nil, delete the newline too. Does not affect the kill ring." (let ((eol (line-end-position))) (delete-region (point) eol) - (if (and newline-too (looking-at "\n")) - (delete-char 1)))) + (when (and newline-too (= (following-char) ?\n)) + (delete-char 1)))) ;; Defvars to avoid compilation warnings: @@ -957,7 +957,7 @@ Lines beginning with `#' are ignored." (error "Not in bookmark-edit-annotation-mode")) (goto-char (point-min)) (while (< (point) (point-max)) - (if (looking-at "^#") + (if (= (following-char) ?#) (bookmark-kill-line t) (forward-line 1))) ;; Take no chances with text properties. @@ -2064,7 +2064,7 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\ (let ((o-point (point)) (o-str (save-excursion (beginning-of-line) - (unless (looking-at "^D") + (unless (= (following-char) ?D) (buffer-substring (point) (progn (end-of-line) (point)))))) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 9f618bcb7de..83d6bb6b0e9 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -1,4 +1,4 @@ -;;; buff-menu.el --- Interface for viewing and manipulating buffers +;;; buff-menu.el --- Interface for viewing and manipulating buffers -*- lexical-binding: t -*- ;; Copyright (C) 1985-1987, 1993-1995, 2000-2017 Free Software ;; Foundation, Inc. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 2b86051a726..fac9c77e12a 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4581,7 +4581,7 @@ This function does not save the buffer." (if (bolp) (princ " ")) (princ ")") - (unless (looking-at-p "\n") + (when (/= (following-char) ?\n) (princ "\n"))))) (defun custom-save-faces () @@ -4636,7 +4636,7 @@ This function does not save the buffer." (if (bolp) (princ " ")) (princ ")") - (unless (looking-at-p "\n") + (when (/= (following-char) ?\n) (princ "\n"))))) ;;; The Customize Menu. diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index c5682add23a..d2ee14d8bdf 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -431,7 +431,7 @@ It includes all variables in list VARS." (if (bolp) (princ " ")) (princ ")") - (unless (looking-at "\n") + (when (/= (following-char) ?\n) (princ "\n"))))) (defun custom-theme-write-faces (theme faces) @@ -463,7 +463,7 @@ It includes all faces in list FACES." (princ ")"))))) (if (bolp) (princ " ")) (princ ")") - (unless (looking-at "\n") + (when (/= (following-char) ?\n) (princ "\n"))))) diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index ca1d75176dc..1b7ff36f422 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -748,7 +748,7 @@ FILE's modification time." (setq output-start (autoload--setup-output otherbuf outbuf absfile load-name))) (autoload--print-cookie-text output-start load-name file)) - ((looking-at ";") + ((= (following-char) ?\;) ;; Don't read the comment. (forward-line 1)) (t diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 6e8442291f8..75e6b904aa6 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2013,7 +2013,7 @@ With argument ARG, insert value in current buffer after the form." ;; Compile the forms from the input buffer. (while (progn (while (progn (skip-chars-forward " \t\n\^l") - (looking-at ";")) + (= (following-char) ?\;)) (forward-line 1)) (not (eobp))) (setq byte-compile-read-position (point) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 59edbe100e1..1d6fdfa4e87 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -603,7 +603,7 @@ style." (checkdoc-overlay-put cdo 'face 'highlight) ;; Make sure the whole doc string is visible if possible. (sit-for 0) - (if (and (looking-at "\"") + (if (and (= (following-char) ?\") (not (pos-visible-in-window-p (save-excursion (forward-sexp 1) (point)) (selected-window)))) @@ -743,9 +743,9 @@ buffer, otherwise searching starts at START-HERE." (while (checkdoc-next-docstring) (message "Searching for doc string spell error...%d%%" (floor (* 100.0 (point)) (point-max))) - (if (looking-at "\"") - (checkdoc-ispell-docstring-engine - (save-excursion (forward-sexp 1) (point-marker))))) + (when (= (following-char) ?\") + (checkdoc-ispell-docstring-engine + (save-excursion (forward-sexp 1) (point-marker))))) (message "Checkdoc: Done.")))) (defun checkdoc-message-interactive-ispell-loop (start-here) @@ -763,7 +763,7 @@ buffer, otherwise searching starts at START-HERE." (while (checkdoc-message-text-next-string (point-max)) (message "Searching for message string spell error...%d%%" (floor (* 100.0 (point)) (point-max))) - (if (looking-at "\"") + (if (= (following-char) ?\") (checkdoc-ispell-docstring-engine (save-excursion (forward-sexp 1) (point-marker))))) (message "Checkdoc: Done.")))) @@ -1381,7 +1381,7 @@ See the style guide in the Emacs Lisp manual for more details." "All variables and subroutines might as well have a \ documentation string") (point) (+ (point) 1) t))))) - (if (and (not err) (looking-at "\"")) + (if (and (not err) (= (following-char) ?\")) (with-syntax-table checkdoc-syntax-table (checkdoc-this-string-valid-engine fp)) err))) @@ -1395,7 +1395,7 @@ regexp short cuts work. FP is the function defun information." ;; we won't accidentally lose our place. This could cause ;; end-of doc string whitespace to also delete the " char. (s (point)) - (e (if (looking-at "\"") + (e (if (= (following-char) ?\") (save-excursion (forward-sexp 1) (point-marker)) (point)))) (or @@ -1475,7 +1475,7 @@ regexp short cuts work. FP is the function defun information." ((looking-at "[\\!?;:.)]") ;; These are ok nil) - ((and checkdoc-permit-comma-termination-flag (looking-at ",")) + ((and checkdoc-permit-comma-termination-flag (= (following-char) ?,)) nil) (t ;; If it is not a complete sentence, let's see if we can diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index d68e49fa4b2..f5e10a24d37 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -372,7 +372,7 @@ Returns the forms." (let ((elint-current-pos (point))) ;; non-list check could be here too. errors may be out of seq. ;; quoted check cannot be elsewhere, since quotes skipped. - (if (looking-back "'" (1- (point))) + (if (= (preceding-char) ?\') ;; Eg cust-print.el uses ' as a comment syntax. (elint-warning "Skipping quoted form `%c%.20s...'" ?\' (read (current-buffer))) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 86364282dcf..aa31fac32cc 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -4520,7 +4520,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back." (interactive) (if viper-cted (let ((p (point)) (c (current-column)) bol (indent t)) - (if (looking-back "[0^]" (1- (point))) + (if (memq (preceding-char) '(?0 ?^)) (progn (if (eq ?^ (preceding-char)) (setq viper-preserve-indent t)) diff --git a/lisp/gnus/mm-bodies.el b/lisp/gnus/mm-bodies.el index 66b9ebd0cfc..d773289722f 100644 --- a/lisp/gnus/mm-bodies.el +++ b/lisp/gnus/mm-bodies.el @@ -68,14 +68,14 @@ Valid encodings are `7bit', `8bit', `quoted-printable' and `base64'." (declare-function message-options-set "message" (symbol value)) (defun mm-encode-body (&optional charset) - "Encode a body. -Should be called narrowed to the body that is to be encoded. + "Encode whole buffer's contents. +Buffer's multibyteness will be turned off when encoding takes place. If there is more than one non-ASCII MULE charset in the body, then the list of MULE charsets found is returned. If CHARSET is non-nil, it is used as the MIME charset to encode the body. If successful, the MIME charset is returned. If no encoding was done, nil is returned." - (if (not (mm-multibyte-p)) + (if (not enable-multibyte-characters) ;; In the non-Mule case, we search for non-ASCII chars and ;; return the value of `mail-parse-charset' if any are found. (or charset @@ -93,8 +93,12 @@ If no encoding was done, nil is returned." (save-excursion (if charset (progn - (encode-coding-region (point-min) (point-max) - (mm-charset-to-coding-system charset)) + (insert + (prog1 + (encode-coding-string (buffer-string) + (mm-charset-to-coding-system charset)) + (erase-buffer) + (set-buffer-multibyte nil))) charset) (goto-char (point-min)) (let ((charsets (mm-find-mime-charset-region (point-min) (point-max) @@ -110,8 +114,12 @@ If no encoding was done, nil is returned." (t (prog1 (setq charset (car charsets)) - (encode-coding-region (point-min) (point-max) - (mm-charset-to-coding-system charset)))) + (insert + (prog1 + (encode-coding-string (buffer-string) + (mm-charset-to-coding-system charset)) + (erase-buffer) + (set-buffer-multibyte nil))))) )))))) (defun mm-long-lines-p (length) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 2a4064560a7..49dba52c884 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1751,8 +1751,8 @@ Ask user for number of images to show and the delay in between." (interactive) (let ((inhibit-read-only t)) (delete-char 1) - (if (looking-at " ") - (delete-char 1)))) + (when (= (following-char) ?\s) + (delete-char 1)))) ;;;###autoload (defun image-dired-display-thumbs-append () diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el index 06b63eae370..92a658655ac 100644 --- a/lisp/international/mule-util.el +++ b/lisp/international/mule-util.el @@ -33,16 +33,6 @@ ;;; String manipulations while paying attention to multibyte characters. ;;;###autoload -(defsubst string-to-list (string) - "Return a list of characters in STRING." - (append string nil)) - -;;;###autoload -(defsubst string-to-vector (string) - "Return a vector of characters in STRING." - (vconcat string)) - -;;;###autoload (defun store-substring (string idx obj) "Embed OBJ (string or character) at index IDX of STRING." (if (integerp obj) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 48dcd5edd11..4b5bd472632 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2133,9 +2133,13 @@ preventing reentrant calls of Tramp.") Together with `tramp-locked', this implements a locking mechanism preventing reentrant calls of Tramp.") -;; Avoid recursive loading of tramp.el. +;; Avoid recursive loading of tramp.el. If `non-essential' is +;; non-nil, we must load tramp.el, in order to get the real definition +;; of `tramp-completion-file-name-handler'. ;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args) -;;;###autoload (tramp-completion-run-real-handler operation args)) +;;;###autoload (if (and (boundp 'non-essential) (symbol-value 'non-essential)) +;;;###autoload (apply 'tramp-autoload-file-name-handler operation args) +;;;###autoload (tramp-completion-run-real-handler operation args))) (defun tramp-completion-file-name-handler (operation &rest args) "Invoke Tramp file name completion handler. @@ -2165,9 +2169,11 @@ Falls back to normal file name handler if no Tramp file name handler exists." (progn (defun tramp-autoload-file-name-handler (operation &rest args) "Load Tramp file name handler, and perform OPERATION." ;; Avoid recursive loading of tramp.el. - (let ((default-directory temporary-file-directory)) - (load "tramp" nil t)) - (apply operation args))) + (if (let ((default-directory temporary-file-directory)) + (and (null load-in-progress) (load "tramp" 'noerror 'nomessage))) + (apply operation args) + ;; tramp.el not available for loading, fall back. + (tramp-completion-run-real-handler operation args)))) ;; `tramp-autoload-file-name-handler' must be registered before ;; evaluation of site-start and init files, because there might exist @@ -2307,11 +2313,10 @@ not in completion mode." (progn ;; If DIR is not given, use `default-directory' or "/". (setq dir (or dir default-directory "/")) - ;; Unless NAME is absolute, concat DIR and NAME. - (unless (file-name-absolute-p name) - (setq name (concat (file-name-as-directory dir) name))) - ;; Return NAME. - name) + (cond + ((file-name-absolute-p name) name) + ((zerop (length name)) dir) + (t (concat (file-name-as-directory dir) name)))) (tramp-completion-run-real-handler 'expand-file-name (list name dir)))) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e01481b6..b42b2bca822 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1687,29 +1687,36 @@ This performs fontification according to `js--class-styles'." js--font-lock-keywords-3) "Font lock keywords for `js-mode'. See `font-lock-keywords'.") -(defconst js--syntax-propertize-regexp-syntax-table - (let ((st (make-char-table 'syntax-table (string-to-syntax ".")))) - (modify-syntax-entry ?\[ "(]" st) - (modify-syntax-entry ?\] ")[" st) - (modify-syntax-entry ?\\ "\\" st) - st)) +(defconst js--syntax-propertize-regexp-regexp + (rx + ;; Start of regexp. + "/" + (0+ (or + ;; Match characters outside of a character class. + (not (any ?\[ ?/ ?\\)) + ;; Match backslash quoted characters. + (and "\\" not-newline) + ;; Match character class. + (and + "[" + (0+ (or + (not (any ?\] ?\\)) + (and "\\" not-newline))) + "]"))) + (group "/")) + "Regular expression matching a JavaScript regexp literal.") (defun js-syntax-propertize-regexp (end) (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (goto-char (nth 8 ppss)) + (when (and (looking-at js--syntax-propertize-regexp-regexp) + ;; Don't touch text after END. + (<= (match-end 1) end)) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"/")) + (goto-char (match-end 0)))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 6c76d7e4ad2..06ffd54d2df 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -1010,7 +1010,7 @@ if the header needs to be version controlled. The following keywords for template generation are supported: <filename> : replaced by the name of the buffer <author> : replaced by the user name and email address - (`user-full-name',`mail-host-address', `user-mail-address') + (`user-full-name', `user-mail-address') <authorfull> : replaced by the user full name (`user-full-name') <login> : replaced by user login name (`user-login-name') <company> : replaced by contents of option `vhdl-company-name' @@ -1967,7 +1967,6 @@ are treated as single words otherwise." (unless (featurep 'xemacs) (custom-add-to-group 'vhdl-related 'transient-mark-mode 'custom-variable)) (custom-add-to-group 'vhdl-related 'user-full-name 'custom-variable) -(custom-add-to-group 'vhdl-related 'mail-host-address 'custom-variable) (custom-add-to-group 'vhdl-related 'user-mail-address 'custom-variable) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/lisp/replace.el b/lisp/replace.el index a825040a979..b96c883982e 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -79,15 +79,14 @@ That becomes the \"string to replace\".") to the minibuffer that reads the string to replace, or invoke replacements from Isearch by using a key sequence like `C-s C-s M-%'." "24.3") -(defcustom query-replace-from-to-separator - (propertize (if (char-displayable-p ?→) " → " " -> ") - 'face 'minibuffer-prompt) - "String that separates FROM and TO in the history of replacement pairs." - ;; Avoids error when attempt to autoload char-displayable-p fails - ;; while preparing to dump, also stops customize-rogue listing this. - :initialize 'custom-initialize-delay +(defcustom query-replace-from-to-separator " → " + "String that separates FROM and TO in the history of replacement pairs. +When nil, the pair will not be added to the history (same behavior +as in emacs 24.5)." :group 'matching - :type '(choice string (sexp :tag "Display specification")) + :type '(choice + (const :tag "Disabled" nil) + string) :version "25.1") (defcustom query-replace-from-history-variable 'query-replace-history @@ -165,14 +164,18 @@ The return value can also be a pair (FROM . TO) indicating that the user wants to replace FROM with TO." (if query-replace-interactive (car (if regexp-flag regexp-search-ring search-ring)) - ;; Reevaluating will check char-displayable-p that is - ;; unavailable while preparing to dump. - (custom-reevaluate-setting 'query-replace-from-to-separator) (let* ((history-add-new-input nil) (separator (when query-replace-from-to-separator (propertize "\0" - 'display query-replace-from-to-separator + 'display + (propertize + (if (char-displayable-p + (string-to-char (replace-regexp-in-string + " " "" query-replace-from-to-separator))) + query-replace-from-to-separator + " -> ") + 'face 'minibuffer-prompt) 'separator t))) (minibuffer-history (append @@ -185,9 +188,13 @@ wants to replace FROM with TO." (symbol-value query-replace-from-history-variable))) (minibuffer-allow-text-properties t) ; separator uses text-properties (prompt - (if (and query-replace-defaults separator) - (format "%s (default %s): " prompt (car minibuffer-history)) - (format "%s: " prompt))) + (cond ((and query-replace-defaults separator) + (format "%s (default %s): " prompt (car minibuffer-history))) + (query-replace-defaults + (format "%s (default %s -> %s): " prompt + (query-replace-descr (caar query-replace-defaults)) + (query-replace-descr (cdar query-replace-defaults)))) + (t (format "%s: " prompt)))) (from ;; The save-excursion here is in case the user marks and copies ;; a region in order to specify the minibuffer input. @@ -200,8 +207,7 @@ wants to replace FROM with TO." (if regexp-flag (read-regexp prompt nil 'minibuffer-history) (read-from-minibuffer - prompt nil nil nil nil - (car (if regexp-flag regexp-search-ring search-ring)) t))))) + prompt nil nil nil nil (car search-ring) t))))) (to)) (if (and (zerop (length from)) query-replace-defaults) (cons (caar query-replace-defaults) diff --git a/lisp/server.el b/lisp/server.el index 1d26caef89c..209bfaaf701 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -245,10 +245,6 @@ in this way." :type 'boolean :version "21.1") -;; FIXME? This is not a minor mode; what's the point of this? (See bug#20201) -(or (assq 'server-buffer-clients minor-mode-alist) - (push '(server-buffer-clients " Server") minor-mode-alist)) - (defvar server-existing-buffer nil "Non-nil means the buffer existed before the server was asked to visit it. This means that the server should not kill the buffer when you say you diff --git a/lisp/simple.el b/lisp/simple.el index c0dad2d36e7..f110c6f3267 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6665,7 +6665,7 @@ even beep.)" ;; whether the trailing whitespace is highlighted. But, it's ;; OK to just do this unconditionally. (skip-chars-forward " \t"))) - (kill-region opoint (if (and kill-whole-line (looking-at "\n")) + (kill-region opoint (if (and kill-whole-line (= (following-char) ?\n)) (1+ (point)) (point))))) diff --git a/lisp/startup.el b/lisp/startup.el index 91e7e36dd65..4272708ce9a 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -376,9 +376,8 @@ this variable usefully is to set it while building and dumping Emacs." (make-obsolete-variable 'system-name "use (system-name) instead" "25.1") (defcustom mail-host-address nil - "Name of this machine, for purposes of naming users. -If non-nil, Emacs uses this instead of `system-name' when constructing -email addresses." + "The name of this machine, for use in constructing email addresses. +If this is nil, Emacs uses `system-name'." :type '(choice (const nil) string) :group 'mail) diff --git a/lisp/subr.el b/lisp/subr.el index a204577ddf9..4f848d1400c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2875,6 +2875,14 @@ See Info node `(elisp)Security Considerations'." (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument)))) )) +(defsubst string-to-list (string) + "Return a list of characters in STRING." + (append string nil)) + +(defsubst string-to-vector (string) + "Return a vector of characters in STRING." + (vconcat string)) + (defun string-or-null-p (object) "Return t if OBJECT is a string or nil. Otherwise, return nil." diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 19746c68e6a..cd86db639ab 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1190,8 +1190,10 @@ to look up will be substituted there." "A helper for `css-lookup-symbol' that finds the symbol at point. Returns the symbol, a string, or nil if none found." (save-excursion - ;; Skip backward over a word first. - (skip-chars-backward "-[:alnum:] \t") + ;; Skip any whitespace between the word and point. + (skip-chars-backward "- \t") + ;; Skip backward over a word. + (skip-chars-backward "-[:alnum:]") ;; Now skip ":" or "@" to see if it's a pseudo-element or at-id. (skip-chars-backward "@:") (if (looking-at css--mdn-symbol-regexp) diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 20b6c3f83b7..fa7621bcd46 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -569,7 +569,7 @@ and all `time-stamp-format' compatibility." ((eq cur-char ?L) ;(undocumented alt user full name) (user-full-name)) ((eq cur-char ?h) ;mail host name - (time-stamp-mail-host-name)) + (or mail-host-address (system-name))) ((eq cur-char ?q) ;(undocumented unqual hostname) (let ((qualname (system-name))) (if (string-match "\\." qualname) @@ -639,17 +639,6 @@ Suggests replacing OLD-FORM with NEW-FORM." (insert "\"" old-form "\" -- use " new-form "\n")) (display-buffer "*Time-stamp-compatibility*")))) - - -(defun time-stamp-mail-host-name () - "Return the name of the host where the user receives mail. -This is the value of `mail-host-address' if bound and a string, -otherwise the value of the function `system-name'." - (or (and (boundp 'mail-host-address) - (stringp mail-host-address) - mail-host-address) - (system-name))) - (provide 'time-stamp) ;;; time-stamp.el ends here diff --git a/lisp/xdg.el b/lisp/xdg.el index b11e104e2b7..4973065f91a 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el @@ -109,6 +109,12 @@ file:///foo/bar.jpg" (defvar xdg-user-dirs nil "Alist of directory keys and values.") +(defun xdg--substitute-home-env (str) + (if (file-name-absolute-p str) str + (save-match-data + (and (string-match "^$HOME/" str) + (replace-match "~/" t nil str 0))))) + (defun xdg--user-dirs-parse-line () "Return pair of user-dirs key to directory value in LINE, otherwise nil. This should be called at the beginning of a line." @@ -117,7 +123,7 @@ This should be called at the beginning of a line." (looking-at xdg-line-regexp)) (let ((k (match-string 1)) (v (match-string 2))) - (when (and k v) (cons k v))))) + (when (and k v) (cons k (xdg--substitute-home-env v)))))) (defun xdg--user-dirs-parse-file (filename) "Return alist of xdg-user-dirs from FILENAME." @@ -137,7 +143,8 @@ This should be called at the beginning of a line." (setq xdg-user-dirs (xdg--user-dirs-parse-file (expand-file-name "user-dirs.dirs" (xdg-config-home))))) - (cdr (assoc name xdg-user-dirs))) + (let ((dir (cdr (assoc name xdg-user-dirs)))) + (when dir (expand-file-name dir)))) (provide 'xdg) diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 7cb737c30e2..d61f084e0df 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -23,6 +23,7 @@ (require 'ert) (require 'js) +(require 'syntax) (ert-deftest js-mode-fill-bug-19399 () (with-temp-buffer @@ -99,6 +100,22 @@ if (!/[ (:,='\"]/.test(value)) { (forward-line) (should (looking-at " \\* test")))) +(ert-deftest js-mode-regexp-syntax-bug-25529 () + (dolist (regexp-contents '("[^[]" + "[/]" + ;; A comment with the regexp on the next + ;; line. + "*comment*/\n/regexp")) + (with-temp-buffer + (js-mode) + (insert "let x = /" regexp-contents "/;\n") + (save-excursion (insert "something();\n")) + ;; The failure mode was that the regexp literal was not + ;; recognized, causing the next line to be given string syntax; + ;; but check for comment syntax as well to prevent an + ;; implementation not recognizing the comment example. + (should-not (syntax-ppss-context (syntax-ppss)))))) + (provide 'js-tests) ;;; js-tests.el ends here diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index 5372c37a179..d601f43002a 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el @@ -226,7 +226,8 @@ ("a:v" "isited" ":visited") ("border-" "color: red" "border-color") ("border-color: red" ";" "border-color") - ("border-color: red; color: green" ";" "color"))) + ("border-color: red; color: green" ";" "color") + (" border-collapse " ": collapse;" "border-collapse"))) (with-temp-buffer (css-mode) (insert (nth 0 item)) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 160d0f106e9..a1b48a643e1 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -473,12 +473,12 @@ (should (lax-plist-get d2 1)) (should-error (lax-plist-get c1 2) :type 'circular-list) (should (lax-plist-get c2 2)) - (should-not (lax-plist-get d1 2)) + (should-error (lax-plist-get d1 2) :type 'wrong-type-argument) (should (lax-plist-get d2 2)) (should-error (lax-plist-get c1 3) :type 'circular-list) (should-error (lax-plist-get c2 3) :type 'circular-list) - (should-not (lax-plist-get d1 3)) - (should-not (lax-plist-get d2 3)))) + (should-error (lax-plist-get d1 3) :type 'wrong-type-argument) + (should-error (lax-plist-get d2 3) :type 'wrong-type-argument))) (ert-deftest test-cycle-plist-member () (let ((c1 (cyc1 1)) @@ -509,12 +509,12 @@ (should (plist-put d2 1 1)) (should-error (plist-put c1 2 2) :type 'circular-list) (should (plist-put c2 2 2)) - (should (plist-put d1 2 2)) + (should-error (plist-put d1 2 2) :type 'wrong-type-argument) (should (plist-put d2 2 2)) (should-error (plist-put c1 3 3) :type 'circular-list) (should-error (plist-put c2 3 3) :type 'circular-list) - (should (plist-put d1 3 3)) - (should (plist-put d2 3 3)))) + (should-error (plist-put d1 3 3) :type 'wrong-type-argument) + (should-error (plist-put d2 3 3) :type 'wrong-type-argument))) (ert-deftest test-cycle-lax-plist-put () (let ((c1 (cyc1 1)) @@ -527,12 +527,12 @@ (should (lax-plist-put d2 1 1)) (should-error (lax-plist-put c1 2 2) :type 'circular-list) (should (lax-plist-put c2 2 2)) - (should (lax-plist-put d1 2 2)) + (should-error (lax-plist-put d1 2 2) :type 'wrong-type-argument) (should (lax-plist-put d2 2 2)) (should-error (lax-plist-put c1 3 3) :type 'circular-list) (should-error (lax-plist-put c2 3 3) :type 'circular-list) - (should (lax-plist-put d1 3 3)) - (should (lax-plist-put d2 3 3)))) + (should-error (lax-plist-put d1 3 3) :type 'wrong-type-argument) + (should-error (lax-plist-put d2 3 3) :type 'wrong-type-argument))) (ert-deftest test-cycle-equal () (should-error (equal (cyc1 1) (cyc1 1))) |