commit c456627ffaf4e73e979883b56117cb91f164936b (HEAD, refs/remotes/origin/master) Merge: 055a895 5a0cbe5 Author: Paul Eggert Date: Mon Apr 18 14:05:32 2016 -0700 Merge from origin/emacs-25 5a0cbe5 Fix Bug#23276 2007e32 Sync with upstream vhdl mode v3.38.1. b6d2552 Tweak configure.ac syntax in recent module patch commit 055a895769a54ac5f23fcc8c97a00fb30e7437b0 Merge: 0808f2a ae71266 Author: Paul Eggert Date: Mon Apr 18 14:05:32 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: ae71266 Port to GCC 5.3.1 20160406 (Red Hat 5.3.1-6) commit 0808f2a1a331fbcb2e6ab57894502b0a34311869 Merge: 3aa73b0 ac00a92 Author: Paul Eggert Date: Mon Apr 18 14:05:31 2016 -0700 Merge from origin/emacs-25 ac00a92 Make sh-electric-here-document-mode accessible in sh-mode-hoo... 3287f48 ; Add entry to MAINTAINERS b85981f * configure.ac (HAVE_MODULES): Exclude gnu-kfreebsd from prev... 0f33284 Make use of rectangle-preview custom variable. aa0d83a Make use of rectangle-preview face. 33bef6e Use 'grep-find-program' in check-declare.el a8560e5 Improve "C-h S" for cl-lib symbols 52e798b Fix minor issues with removing left or right fringes d6ffd64 Speed up redisplay in ansi-term mode 4ab671c Simplify 8-bit character handling by terminal for 'raw-text' f3653ec * configure.ac (HAVE_MODULES): Treat gnu like gnu-linux. (Bu... ab849b7 Fix w32 memory-management problem when extending buffer text commit 3aa73b04e81ebc396892b14e5e9fa78a13ff85d1 Merge: dd92b5f 1b98a68 Author: Paul Eggert Date: Mon Apr 18 14:05:31 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: 1b98a68 Fix Bug#20637. Do not merge to master commit dd92b5f5047931f6020045ce47360b62d1c2cb72 Merge: d11abb2 32364bb Author: Paul Eggert Date: Mon Apr 18 14:05:31 2016 -0700 Merge from origin/emacs-25 32364bb substitute-command-keys keeps quotes’ text props 567ab52 * src/xwidget.c (x_draw_xwidget_glyph_string): More clipping ... 24b87a1 Add semantic-symref-filepattern-alist entry for lisp-interact... cc0b713 Perform xref searches without visiting unopened files 5045575 Revert "Prevent bootstrap autoload backup files" commit d11abb25428e9a468a5525c462489eb5a854798f Author: Philipp Stephani Date: Mon Apr 18 12:32:35 2016 -0400 * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix docstring so that it matches the actual implementation. See https://lists.gnu.org/archive/html/help-gnu-emacs/2016-04/msg00071.html diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 6a4d835..46d5d0d 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -108,9 +108,10 @@ Optional LIGHTER is displayed in the mode line when the mode is on. Optional KEYMAP is the default keymap bound to the mode keymap. If non-nil, it should be a variable name (whose value is a keymap), or an expression that returns either a keymap or a list of - arguments for `easy-mmode-define-keymap'. If you supply a KEYMAP - argument that is not a symbol, this macro defines the variable - MODE-map and gives it the value that KEYMAP specifies. + (KEY . BINDING) pairs where KEY and BINDING are suitable for + `define-key'. If you supply a KEYMAP argument that is not a + symbol, this macro defines the variable MODE-map and gives it + the value that KEYMAP specifies. BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running MODE-hook. commit 03887a1932e30da3f77f4ba80f67affb330ec56c Author: Stefan Monnier Date: Mon Apr 18 12:27:58 2016 -0400 * lisp/textmodes/ispell.el: Compile with lexical-binding (declare-function): Don't define any more. (ispell-check-minver, ispell-looking-back): Tweak definition so that the compiler can obviously know that it's always defined. (ispell-debug-buffer): Declare var. (ispell-hunspell-fill-dictionary-entry) (ispell-parse-hunspell-affix-file, ispell-hunspell-add-multi-dic) (ispell-find-hunspell-dictionaries, ispell-set-spellchecker-params) (ispell-command-loop): Avoid add-to-list on local variables. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 5a1f473..a139c06 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1,4 +1,4 @@ -;;; ispell.el --- interface to International Ispell Versions 3.1 and 3.2 +;;; ispell.el --- interface to International Ispell Versions 3.1 and 3.2 -*- lexical-binding:t -*- ;; Copyright (C) 1994-1995, 1997-2016 Free Software Foundation, Inc. @@ -46,9 +46,9 @@ ;; your own dictionaries. ;; Depending on the mail system you use, you may want to include these: -;; (add-hook 'news-inews-hook 'ispell-message) -;; (add-hook 'mail-send-hook 'ispell-message) -;; (add-hook 'mh-before-send-letter-hook 'ispell-message) +;; (add-hook 'news-inews-hook #'ispell-message) +;; (add-hook 'mail-send-hook #'ispell-message) +;; (add-hook 'mh-before-send-letter-hook #'ispell-message) ;; Ispell has a TeX parser and a nroff parser (the default). ;; The parsing is controlled by the variable ispell-parser. Currently @@ -196,54 +196,46 @@ ;; Fixed bug in returning to nroff mode from tex mode. ;;; Compatibility code for XEmacs and (not too) older emacsen: - -(eval-and-compile ;; Protect against declare-function undefined in XEmacs - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) - -(declare-function ispell-check-minver "ispell" (v1 v2)) -(declare-function ispell-looking-back "ispell" - (regexp &optional limit &rest ignored)) - -(if (fboundp 'version<=) - (defalias 'ispell-check-minver 'version<=) - (defun ispell-check-minver (minver version) - "Check if string VERSION is at least string MINVER. +(defalias 'ispell-check-minver + (if (fboundp 'version<=) 'version<= + (lambda (minver version) + "Check if string VERSION is at least string MINVER. Both must be in [0-9]+.[0-9]+... format. This is a fallback compatibility function in case `version<=' is not available." - (let ((pending t) - (return t) - start-ver start-mver) - ;; Loop until an absolute greater or smaller condition is reached - ;; or until no elements are left in any of version and minver. In - ;; this case version is exactly the minimal, so return OK. - (while pending - (let (ver mver) - (if (string-match "[0-9]+" version start-ver) - (setq start-ver (match-end 0) - ver (string-to-number (match-string 0 version)))) - (if (string-match "[0-9]+" minver start-mver) - (setq start-mver (match-end 0) - mver (string-to-number (match-string 0 minver)))) - - (if (or ver mver) - (progn - (or ver (setq ver 0)) - (or mver (setq mver 0)) - ;; If none of below conditions match, this element is the - ;; same. Go checking next element. - (if (> ver mver) - (setq pending nil) - (if (< ver mver) - (setq pending nil - return nil)))) - (setq pending nil)))) - return))) + (let ((pending t) + (return t) + start-ver start-mver) + ;; Loop until an absolute greater or smaller condition is reached + ;; or until no elements are left in any of version and minver. In + ;; this case version is exactly the minimal, so return OK. + (while pending + (let (ver mver) + (if (string-match "[0-9]+" version start-ver) + (setq start-ver (match-end 0) + ver (string-to-number (match-string 0 version)))) + (if (string-match "[0-9]+" minver start-mver) + (setq start-mver (match-end 0) + mver (string-to-number (match-string 0 minver)))) + + (if (or ver mver) + (progn + (or ver (setq ver 0)) + (or mver (setq mver 0)) + ;; If none of below conditions match, this element is the + ;; same. Go checking next element. + (if (> ver mver) + (setq pending nil) + (if (< ver mver) + (setq pending nil + return nil)))) + (setq pending nil)))) + return)))) ;; XEmacs does not have looking-back -(if (fboundp 'looking-back) - (defalias 'ispell-looking-back 'looking-back) - (defun ispell-looking-back (regexp &optional limit &rest ignored) - "Return non-nil if text before point matches regular expression REGEXP. +(defalias 'ispell-looking-back + (if (fboundp 'looking-back) 'looking-back + (lambda (regexp &optional limit &rest ignored) + "Return non-nil if text before point matches regular expression REGEXP. Like `looking-at' except matches before point, and is slower. LIMIT if non-nil speeds up the search by specifying a minimum starting position, to avoid checking matches that would start @@ -251,8 +243,8 @@ before LIMIT. This is a stripped down compatibility function for use when full featured `looking-back' function is missing." - (save-excursion - (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)))) + (save-excursion + (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t))))) ;;; XEmacs21 does not have `with-no-warnings'. Taken from org mode. (defmacro ispell-with-no-warnings (&rest body) @@ -260,6 +252,8 @@ full featured `looking-back' function is missing." ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defvar mail-yank-prefix) (defgroup ispell nil @@ -942,6 +936,8 @@ Otherwise returns the library directory name, if that is defined." (setq default-directory (expand-file-name "~/"))) (apply 'call-process-region args))) +(defvar ispell-debug-buffer) + (defun ispell-create-debug-buffer (&optional append) "Create an ispell debug buffer for debugging output. If APPEND is non-nil, append the info to previous buffer if exists, @@ -1182,15 +1178,15 @@ all uninitialized dicts using that affix file." (if (cadr (assoc tmp-dict ispell-dictionary-alist)) (ispell-print-if-debug "ispell-hfde: %s already expanded; skipping.\n" tmp-dict) - (add-to-list 'use-for-dicts tmp-dict)))))) + (cl-pushnew tmp-dict use-for-dicts :test #'equal)))))) (ispell-print-if-debug "ispell-hfde: Filling %s entry. Use for %s.\n" dict use-for-dicts) ;; The final loop. (dolist (entry ispell-dictionary-alist) - (if (member (car entry) use-for-dicts) - (add-to-list 'newlist - (append (list (car entry)) dict-args-cdr)) - (add-to-list 'newlist entry))) + (cl-pushnew (if (member (car entry) use-for-dicts) + (cons (car entry) dict-args-cdr) + entry) + newlist :test #'equal)) (setq ispell-dictionary-alist newlist)))) (defun ispell-parse-hunspell-affix-file (dict-key) @@ -1235,7 +1231,7 @@ did." (chars-list (append otherchars-string nil))) (setq chars-list (delq ?\ chars-list)) (dolist (ch chars-list) - (add-to-list 'otherchars-list ch))))) + (cl-pushnew ch otherchars-list :test #'equal))))) ;; Cons the argument for the -d switch. (setq dict-arg (concat dict-arg (if (> (length dict-arg) 0) ",") @@ -1246,7 +1242,7 @@ did." "[[:alpha:]]" "[^[:alpha:]]" (if otherchars-list - (regexp-opt (mapcar 'char-to-string otherchars-list)) + (regexp-opt (mapcar #'char-to-string otherchars-list)) "") t ; many-otherchars-p: We can't tell, set to t. (list "-d" dict-arg) @@ -1268,7 +1264,7 @@ in the list must have an affix file where Hunspell affix files are kept." (or (assoc first-dict ispell-local-dictionary-alist) (assoc first-dict ispell-dictionary-alist) (error "Unknown dictionary: %s" first-dict))) - (add-to-list 'ispell-dictionary-alist (list dict '())) + (cl-pushnew (list dict '()) ispell-dictionary-alist :test #'equal) (ispell-hunspell-fill-dictionary-entry dict)) (defun ispell-find-hunspell-dictionaries () @@ -1308,8 +1304,8 @@ entries if a specific dictionary was found." (ispell-print-if-debug "++ ispell-fhd: dict-entry:%s name:%s basename:%s affix-file:%s\n" dict full-name basename affix-file) - (add-to-list 'ispell-hunspell-dict-paths-alist - (list basename affix-file))) + (cl-pushnew (list basename affix-file) + ispell-hunspell-dict-paths-alist :test #'equal)) (ispell-print-if-debug "-- ispell-fhd: Skipping entry: %s\n" dict))))) ;; Remove entry from aliases alist if explicit dict was found. @@ -1319,7 +1315,7 @@ entries if a specific dictionary was found." (ispell-print-if-debug "-- ispell-fhd: Excluding %s alias. Standalone dict found.\n" (car dict)) - (add-to-list 'newlist dict))) + (cl-pushnew dict newlist :test #'equal))) (setq ispell-dicts-name2locale-equivs-alist newlist)) ;; Add known hunspell aliases (dolist (dict-equiv ispell-dicts-name2locale-equivs-alist) @@ -1337,22 +1333,20 @@ entries if a specific dictionary was found." ispell-hunspell-dict-paths-alist)))) (ispell-print-if-debug "++ ispell-fhd: Adding alias %s -> %s.\n" dict-equiv-key affix-file) - (add-to-list - 'ispell-hunspell-dict-paths-alist - (list dict-equiv-key affix-file)))))) + (cl-pushnew (list dict-equiv-key affix-file) + ispell-hunspell-dict-paths-alist :test #'equal))))) ;; Parse and set values for default dictionary. (setq hunspell-default-dict (car hunspell-default-dict)) (setq hunspell-default-dict-entry (ispell-parse-hunspell-affix-file hunspell-default-dict)) ;; Create an alist of found dicts with only names, except for default dict. (setq ispell-hunspell-dictionary-alist - (list (append (list nil) (cdr hunspell-default-dict-entry)))) - (dolist (dict (mapcar 'car ispell-hunspell-dict-paths-alist)) - (if (string= dict hunspell-default-dict) - (add-to-list 'ispell-hunspell-dictionary-alist - hunspell-default-dict-entry) - (add-to-list 'ispell-hunspell-dictionary-alist - (list dict)))))) + (list (cons nil (cdr hunspell-default-dict-entry)))) + (dolist (dict (mapcar #'car ispell-hunspell-dict-paths-alist)) + (cl-pushnew (if (string= dict hunspell-default-dict) + hunspell-default-dict-entry + (list dict)) + ispell-hunspell-dictionary-alist :test #'equal)))) ;; Set params according to the selected spellchecker @@ -1443,17 +1437,17 @@ aspell is used along with Emacs).") (setq skip-dict t))) (unless skip-dict - (add-to-list 'tmp-dicts-alist - (list - dict-name ; dict name - (nth 1 adict) ; casechars - (nth 2 adict) ; not-casechars - (nth 3 adict) ; otherchars - (nth 4 adict) ; many-otherchars-p - ispell-args ; ispell-args - (nth 6 adict) ; extended-character-mode - (nth 7 adict) ; dict encoding - )))) + (cl-pushnew (list + dict-name ; dict name + (nth 1 adict) ; casechars + (nth 2 adict) ; not-casechars + (nth 3 adict) ; otherchars + (nth 4 adict) ; many-otherchars-p + ispell-args ; ispell-args + (nth 6 adict) ; extended-character-mode + (nth 7 adict) ; dict encoding + ) + tmp-dicts-alist :test #'equal))) (setq ispell-dictionary-base-alist tmp-dicts-alist)))) (run-hooks 'ispell-initialize-spellchecker-hook) @@ -1463,7 +1457,7 @@ aspell is used along with Emacs).") ispell-base-dicts-override-alist ispell-dictionary-base-alist)) (unless (assoc (car dict) all-dicts-alist) - (add-to-list 'all-dicts-alist dict))) + (push dict all-dicts-alist))) (setq ispell-dictionary-alist all-dicts-alist)) ;; If Emacs flavor supports [:alpha:] use it for global dicts. If @@ -1473,20 +1467,20 @@ aspell is used along with Emacs).") (if ispell-emacs-alpha-regexp (let (tmp-dicts-alist) (dolist (adict ispell-dictionary-alist) - (if (cadr adict) ;; Do not touch hunspell uninitialized entries - (add-to-list 'tmp-dicts-alist - (list - (nth 0 adict) ; dict name - "[[:alpha:]]" ; casechars - "[^[:alpha:]]" ; not-casechars - (nth 3 adict) ; otherchars - (nth 4 adict) ; many-otherchars-p - (nth 5 adict) ; ispell-args - (nth 6 adict) ; extended-character-mode - (if ispell-encoding8-command - 'utf-8 - (nth 7 adict)))) - (add-to-list 'tmp-dicts-alist adict))) + (cl-pushnew (if (cadr adict) ;; Do not touch hunspell uninitialized entries + (list + (nth 0 adict) ; dict name + "[[:alpha:]]" ; casechars + "[^[:alpha:]]" ; not-casechars + (nth 3 adict) ; otherchars + (nth 4 adict) ; many-otherchars-p + (nth 5 adict) ; ispell-args + (nth 6 adict) ; extended-character-mode + (if ispell-encoding8-command + 'utf-8 + (nth 7 adict))) + adict) + tmp-dicts-alist :test #'equal)) (setq ispell-dictionary-alist tmp-dicts-alist))))) (defun ispell-valid-dictionary-list () @@ -2428,7 +2422,8 @@ Global `ispell-quit' set to start location to continue spell session." nil) ((or (= char ?a) (= char ?A)) ; accept word without insert (ispell-send-string (concat "@" word "\n")) - (add-to-list 'ispell-buffer-session-localwords word) + (cl-pushnew word ispell-buffer-session-localwords + :test #'equal) (and (fboundp 'flyspell-unhighlight-at) (flyspell-unhighlight-at start)) (or ispell-buffer-local-name ; session localwords might conflict @@ -2761,7 +2756,7 @@ if defined." ;; This is the case when a process dies or fails. The default behavior ;; in this case treats the next input received as fresh input. -(defun ispell-filter (process output) +(defun ispell-filter (_process output) "Output filter function for ispell, grep, and look." (let ((start 0) (continue t) @@ -3041,14 +3036,13 @@ Keeps argument list for future Ispell invocations for no async support." (ispell-send-string "\032\n") ; so Ispell prints version and exits t))) - (defun ispell-init-process () "Check status of Ispell process and start if necessary." (let* (;; Basename of dictionary used by the spell-checker (dict-bname (or (car (cdr (member "-d" (ispell-get-ispell-args)))) ispell-current-dictionary)) ;; The directory where process was started. - (current-ispell-directory default-directory) + (current-ispell-directory default-directory) ;FIXME: Unused? ;; The default directory for the process. ;; Use "~/" as default-directory unless using Ispell with per-dir ;; personal dictionaries and not in a minibuffer under XEmacs @@ -3151,7 +3145,7 @@ Keeps argument list for future Ispell invocations for no async support." ;; Otherwise we get cool errors like "Can't open ". (sleep-for 1) (ispell-accept-output 3) - (error "%s" (mapconcat 'identity ispell-filter "\n")))) + (error "%s" (mapconcat #'identity ispell-filter "\n")))) (setq ispell-filter nil) ; Discard version ID line (let ((extended-char-mode (ispell-get-extended-character-mode))) (if extended-char-mode ; ~ extended character mode @@ -3207,7 +3201,7 @@ By just answering RET you can find out what the current dictionary is." (list (completing-read "Use new dictionary (RET for current, SPC to complete): " (and (fboundp 'ispell-valid-dictionary-list) - (mapcar 'list (ispell-valid-dictionary-list))) + (mapcar #'list (ispell-valid-dictionary-list))) nil t) current-prefix-arg)) (ispell-set-spellchecker-params) ; Initialize variables and dicts alists @@ -3413,7 +3407,7 @@ ispell-region: Search for first region to skip after (ispell-begin-skip-region-r Includes `ispell-skip-region-alist' plus tex, tib, html, and comment keys. Must be called after `ispell-buffer-local-parsing' due to dependence on mode." (mapconcat - 'identity + #'identity (delq nil (list ;; messages @@ -3870,7 +3864,7 @@ Standard ispell choices are then available." (setq case-fold-search nil) ; Try and respect case of word. (cond ((string-equal (upcase word) word) - (setq possibilities (mapcar 'upcase possibilities))) + (setq possibilities (mapcar #'upcase possibilities))) ((eq (upcase (aref word 0)) (aref word 0)) (setq possibilities (mapcar (function (lambda (pos) @@ -4104,10 +4098,10 @@ The `X' command aborts sending the message so that you can edit the buffer. To spell-check whenever a message is sent, include the appropriate lines in your init file: - (add-hook \\='message-send-hook \\='ispell-message) ;; GNUS 5 - (add-hook \\='news-inews-hook \\='ispell-message) ;; GNUS 4 - (add-hook \\='mail-send-hook \\='ispell-message) - (add-hook \\='mh-before-send-letter-hook \\='ispell-message) + (add-hook \\='message-send-hook #\\='ispell-message) ;; GNUS 5 + (add-hook \\='news-inews-hook #\\='ispell-message) ;; GNUS 4 + (add-hook \\='mail-send-hook #\\='ispell-message) + (add-hook \\='mh-before-send-letter-hook #\\='ispell-message) You can bind this to the key C-c i in GNUS or mail by adding to `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression: @@ -4429,6 +4423,7 @@ Both should not be used to define a buffer-local dictionary." (insert comment-end))))) (insert (concat " " word)))))))) +;;FIXME: Use `user-error' instead! (add-to-list 'debug-ignored-errors "^No word found to check!$") (provide 'ispell) commit 5a0cbe51f4a32aedb2060bf18afc36c4dfe329db Author: Michael Albinus Date: Mon Apr 18 10:11:44 2016 +0200 Fix Bug#23276 * lisp/autorevert.el (auto-revert-handler): Ignore errors coming from `revert-buffer'. (Bug#23276) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index b7f1f36..b8693df 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -684,7 +684,10 @@ This is an internal function used by Auto-Revert Mode." ;; not to forget that. This gives undesirable results when ;; the file's mode changes, but that is less common. (let ((buffer-read-only buffer-read-only)) - (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))) + ;; Bug#23276: When the file has been deleted, keep the + ;; buffer unchanged. + (ignore-errors + (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)))) (when buffer-file-name (when eob (goto-char (point-max))) (dolist (window eoblist) commit 2007e324443c125d1d88818a875c90f103698010 Author: Reto Zimmermann Date: Sun Apr 17 16:15:29 2016 -0700 Sync with upstream vhdl mode v3.38.1. * lisp/progmodes/vhdl-mode.el (vhdl-version, vhdl-time-stamp): Update. (vhdl-mode): No longer set comment-padding. (vhdl-begin-p): Handle missing space between keyword and parenthesis. (vhdl-beginning-of-statement-1): Fix indentation for "else generate". (vhdl-template-else, vhdl-template-elsif): Support generate statement. (vhdl-re-search-forward, vhdl-re-search-backward): Save match data. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 27ce9fb..a390494 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -13,10 +13,10 @@ ;; filed in the Emacs bug reporting system against this file, a copy ;; of the bug report be sent to the maintainer's email address. -(defconst vhdl-version "3.37.1" +(defconst vhdl-version "3.38.1" "VHDL Mode version number.") -(defconst vhdl-time-stamp "2015-01-15" +(defconst vhdl-time-stamp "2015-03-12" "VHDL Mode time stamp for last update.") ;; This file is part of GNU Emacs. @@ -4876,8 +4876,6 @@ Key bindings: (set (make-local-variable 'indent-line-function) 'vhdl-indent-line) (set (make-local-variable 'comment-start) "--") (set (make-local-variable 'comment-end) "") - (when vhdl-emacs-21 - (set (make-local-variable 'comment-padding) "")) (set (make-local-variable 'comment-column) vhdl-inline-comment-column) (set (make-local-variable 'end-comment-column) vhdl-end-comment-column) (set (make-local-variable 'comment-start-skip) "--+\\s-*") @@ -6001,6 +5999,7 @@ keyword." ;; following search list so that we don't run into ;; semicolons in the function interface list. (backward-sexp) + (skip-chars-forward "(") (let (foundp) (while (and (not foundp) (re-search-backward @@ -6779,7 +6778,8 @@ statement if already at the beginning of one." ;; start point was not inside leader area ;; set stop point at word after leader (setq pos (point)))) - (forward-word-strictly 1) + (unless (looking-at "\\") + (forward-word-strictly 1)) (vhdl-forward-syntactic-ws here) (setq pos (point))) (goto-char pos) @@ -9311,9 +9311,11 @@ a configuration declaration if not within a design unit." (let (margin) (vhdl-prepare-search-1 (vhdl-insert-keyword "ELSE") - (if (and (save-excursion (vhdl-re-search-backward "\\(\\\\|;\\)" nil t)) - (equal "WHEN" (upcase (match-string 1)))) + (if (and (save-excursion (vhdl-re-search-backward "\\(\\(\\\\)\\|;\\)" nil t)) + (match-string 2)) (insert " ") + (unless (vhdl-sequential-statement-p) + (vhdl-insert-keyword " GENERATE")) (indent-according-to-mode) (setq margin (current-indentation)) (insert "\n") @@ -9325,15 +9327,16 @@ a configuration declaration if not within a design unit." (let ((start (point)) margin) (vhdl-insert-keyword "ELSIF ") - (when (or (vhdl-sequential-statement-p) (vhdl-standard-p 'ams)) (when vhdl-conditions-in-parenthesis (insert "(")) (when (vhdl-template-field "condition" nil t start (point)) (when vhdl-conditions-in-parenthesis (insert ")")) (indent-according-to-mode) (setq margin (current-indentation)) (vhdl-insert-keyword - (concat " " (if (vhdl-sequential-statement-p) "THEN" "USE") "\n")) - (indent-to (+ margin vhdl-basic-offset)))))) + (concat " " (cond ((vhdl-sequential-statement-p) "THEN") + ((vhdl-standard-p 'ams) "USE") + (t "GENERATE")) "\n")) + (indent-to (+ margin vhdl-basic-offset))))) (defun vhdl-template-entity () "Insert an entity." @@ -13001,7 +13004,7 @@ File statistics: \"%s\"\n\ (let (pos) (save-excursion (while (and (setq pos (re-search-forward regexp bound noerror count)) - (vhdl-in-literal)))) + (save-match-data (vhdl-in-literal))))) (when pos (goto-char pos)) pos)) @@ -13010,7 +13013,7 @@ File statistics: \"%s\"\n\ (let (pos) (save-excursion (while (and (setq pos (re-search-backward regexp bound noerror count)) - (vhdl-in-literal)))) + (save-match-data (vhdl-in-literal))))) (when pos (goto-char pos)) pos)) commit ae712666bb25285ee321476fc043321ca42eb5a2 Author: Paul Eggert Date: Sat Apr 16 19:47:33 2016 -0700 Port to GCC 5.3.1 20160406 (Red Hat 5.3.1-6) * src/indent.c (Fvertical_motion): Pacify --enable-gcc-warnings when using the April 6 Fedora patch to GCC. diff --git a/src/indent.c b/src/indent.c index d5162e3..0ef8903 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2036,7 +2036,7 @@ whether or not it is currently displayed in some window. */) bool disp_string_at_start_p = 0; ptrdiff_t nlines = XINT (lines); int vpos_init = 0; - double start_col; + double start_col IF_LINT (= 0); int start_x IF_LINT (= 0); int to_x = -1; commit b6d2552fe371d8cb4e7216aa9e5f86ecf64d7a78 Author: Paul Eggert Date: Sat Apr 16 19:49:15 2016 -0700 Tweak configure.ac syntax in recent module patch * configure.ac: Use proper Autoconf parenthesization in recent HAVE_MODULES patch. Although this doesn’t fix any bugs, the previous syntax was confusing. diff --git a/configure.ac b/configure.ac index 89bc0c5..7184d68 100644 --- a/configure.ac +++ b/configure.ac @@ -3351,9 +3351,10 @@ if test "${with_modules}" != "no"; then HAVE_MODULES=yes ;; *) - # BSD system have dlopen in the libc - AC_CHECK_FUNC(dlopen, [MODULES_SUFFIX=".so"] - [HAVE_MODULES=yes], []) + # BSD systems have dlopen in libc. + AC_CHECK_FUNC([dlopen], + [MODULES_SUFFIX=".so" + HAVE_MODULES=yes]) ;; esac commit ac00a92e3df7111c0eb2c6456ae7df5850bfd8fa Author: Mark Oteiza Date: Sat Apr 16 14:40:17 2016 -0400 Make sh-electric-here-document-mode accessible in sh-mode-hook. (Bug#3226) * lisp/progmodes/sh-script.el (sh-mode-hook): Add sh-electric-here-document-mode as an option and the default value. (sh-mode): Mention sh-mode-hook in docstring. (sh-mode): Remove sh-electric-here-document-mode invocation. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 4fb5835..4f160e1 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1225,9 +1225,10 @@ and command `sh-reset-indent-vars-to-global-values'." :type 'hook :group 'sh-script) -(defcustom sh-mode-hook nil +(defcustom sh-mode-hook '(sh-electric-here-document-mode) "Hook run by `sh-mode'." :type 'hook + :options '(sh-electric-here-document-mode) :group 'sh-script) (defcustom sh-learn-basic-offset nil @@ -1616,7 +1617,8 @@ buffer indents as it currently is indented. \\[sh-execute-region] Have optional header and region be executed in a subshell. `sh-electric-here-document-mode' controls whether insertion of two -unquoted < insert a here document. +unquoted < insert a here document. You can control this behavior by +modifying `sh-mode-hook'. If you generally program a shell different from your login shell you can set `sh-shell-file' accordingly. If your shell's file name doesn't correctly @@ -1653,7 +1655,6 @@ with your script for an edit-interpret-debug cycle." (setq-local syntax-propertize-function #'sh-syntax-propertize-function) (add-hook 'syntax-propertize-extend-region-functions #'syntax-propertize-multiline 'append 'local) - (sh-electric-here-document-mode 1) (setq-local skeleton-pair-alist '((?` _ ?`))) (setq-local skeleton-pair-filter-function 'sh-quoted-p) (setq-local skeleton-further-elements commit 3287f48f5dbd8f761c67b0e8efba27bc4de82133 Author: Michael Albinus Date: Sat Apr 16 20:46:06 2016 +0200 ; Add entry to MAINTAINERS diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 859046a..b15c57e 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS @@ -73,6 +73,7 @@ Michael Albinus File Notifications src/gfilenotify.c + src/kqueue.c lisp/filenotify.el test/automated/file-notify-tests.el commit b85981feac79c12f4966199411f74acb892cc1ff Author: Glenn Morris Date: Sat Apr 16 10:24:57 2016 -0700 * configure.ac (HAVE_MODULES): Exclude gnu-kfreebsd from previous. diff --git a/configure.ac b/configure.ac index d803363..89bc0c5 100644 --- a/configure.ac +++ b/configure.ac @@ -3337,7 +3337,7 @@ MODULES_OBJ= MODULES_SUFFIX= if test "${with_modules}" != "no"; then case $opsys in - gnu*) + gnu|gnu-linux) LIBMODULES="-ldl" MODULES_SUFFIX=".so" HAVE_MODULES=yes commit 0f332848cdb2ed6d46771914a911cbca194cd51a Author: Mark Oteiza Date: Sat Apr 16 12:02:49 2016 -0400 Make use of rectangle-preview custom variable. lisp/rect.el (rectangle--string-preview): Only create a preview if rectangle-preview is non-nil (Bug#23248). diff --git a/lisp/rect.el b/lisp/rect.el index fc08747..6056b14 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -408,40 +408,41 @@ With a prefix (or a FILL) argument, also fill too short lines." :type 'boolean) (defun rectangle--string-preview () - (let ((str (minibuffer-contents))) - (when (equal str "") - (setq str (or (car-safe minibuffer-default) - (if (stringp minibuffer-default) minibuffer-default)))) - (when str (setq str (propertize str 'face 'rectangle-preview))) - (with-selected-window rectangle--string-preview-window - (unless (or (null rectangle--string-preview-state) - (equal str (car rectangle--string-preview-state))) - (rectangle--string-flush-preview) - (apply-on-rectangle - (lambda (startcol endcol) - (let* ((sc (move-to-column startcol)) - (start (if (<= sc startcol) (point) - (forward-char -1) - (setq sc (current-column)) - (point))) - (ec (move-to-column endcol)) - (end (point)) - (ol (make-overlay start end))) - (push ol (nthcdr 3 rectangle--string-preview-state)) - ;; FIXME: The extra spacing doesn't interact correctly with - ;; the extra spacing added by the rectangular-region-highlight. - (when (< sc startcol) - (overlay-put ol 'before-string (rectangle--space-to startcol))) - (let ((as (when (< endcol ec) - ;; (rectangle--space-to ec) - (spaces-string (- ec endcol)) - ))) - (if (= start end) - (overlay-put ol 'after-string (if as (concat str as) str)) - (overlay-put ol 'display str) - (if as (overlay-put ol 'after-string as)))))) - (nth 1 rectangle--string-preview-state) - (nth 2 rectangle--string-preview-state)))))) + (when rectangle-preview + (let ((str (minibuffer-contents))) + (when (equal str "") + (setq str (or (car-safe minibuffer-default) + (if (stringp minibuffer-default) minibuffer-default)))) + (when str (setq str (propertize str 'face 'rectangle-preview))) + (with-selected-window rectangle--string-preview-window + (unless (or (null rectangle--string-preview-state) + (equal str (car rectangle--string-preview-state))) + (rectangle--string-flush-preview) + (apply-on-rectangle + (lambda (startcol endcol) + (let* ((sc (move-to-column startcol)) + (start (if (<= sc startcol) (point) + (forward-char -1) + (setq sc (current-column)) + (point))) + (ec (move-to-column endcol)) + (end (point)) + (ol (make-overlay start end))) + (push ol (nthcdr 3 rectangle--string-preview-state)) + ;; FIXME: The extra spacing doesn't interact correctly with + ;; the extra spacing added by the rectangular-region-highlight. + (when (< sc startcol) + (overlay-put ol 'before-string (rectangle--space-to startcol))) + (let ((as (when (< endcol ec) + ;; (rectangle--space-to ec) + (spaces-string (- ec endcol)) + ))) + (if (= start end) + (overlay-put ol 'after-string (if as (concat str as) str)) + (overlay-put ol 'display str) + (if as (overlay-put ol 'after-string as)))))) + (nth 1 rectangle--string-preview-state) + (nth 2 rectangle--string-preview-state))))))) ;; FIXME: Should this be turned into inhibit-region-highlight and made to apply ;; to non-rectangular regions as well? commit aa0d83a727aa8868911d68f03d0b6e6ae37ff017 Author: Mark Oteiza Date: Sat Apr 16 11:55:59 2016 -0400 Make use of rectangle-preview face. * lisp/rect.el (rectangle--string-preview): (rectangle--highlight-for-redisplay): Replace 'region with 'rectangle-preview (Bug#23248). diff --git a/lisp/rect.el b/lisp/rect.el index 685213a..fc08747 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -412,7 +412,7 @@ With a prefix (or a FILL) argument, also fill too short lines." (when (equal str "") (setq str (or (car-safe minibuffer-default) (if (stringp minibuffer-default) minibuffer-default)))) - (when str (setq str (propertize str 'face 'region))) + (when str (setq str (propertize str 'face 'rectangle-preview))) (with-selected-window rectangle--string-preview-window (unless (or (null rectangle--string-preview-state) (equal str (car rectangle--string-preview-state))) @@ -782,7 +782,7 @@ Ignores `line-move-visual'." (if (not old) (let ((ol (make-overlay left right))) (overlay-put ol 'window window) - (overlay-put ol 'face 'region) + (overlay-put ol 'face 'rectangle-preview) ol) (let ((ol (pop old))) (move-overlay ol left right (current-buffer)) @@ -814,7 +814,7 @@ Ignores `line-move-visual'." (overlay-put ol 'after-string nil))) ((< mright rightcol) ;`rightcol' is past EOL. (let ((str (rectangle--space-to rightcol))) - (put-text-property 0 (length str) 'face 'region str) + (put-text-property 0 (length str) 'face 'rectangle-preview str) ;; If cursor happens to be here, draw it at the right place. (rectangle--place-cursor leftcol left str) (overlay-put ol 'after-string str))) @@ -826,7 +826,7 @@ Ignores `line-move-visual'." (overlay-put ol 'after-string nil) (goto-char right) (let ((str (rectangle--space-to rightcol))) - (put-text-property 0 (length str) 'face 'region str) + (put-text-property 0 (length str) 'face 'rectangle-preview str) (when (= left right) (rectangle--place-cursor leftcol left str)) (overlay-put ol 'after-string str)))) @@ -836,7 +836,7 @@ Ignores `line-move-visual'." ;; Make zero-width rectangles visible! (overlay-put ol 'after-string (concat (propertize " " - 'face '(region (:height 0.2))) + 'face '(rectangle-preview (:height 0.2))) (overlay-get ol 'after-string)))) (push ol nrol))) start end)) commit 33bef6e90bfd20609d044b8a076c1570c627684a Author: Eli Zaretskii Date: Sat Apr 16 14:54:03 2016 +0300 Use 'grep-find-program' in check-declare.el * lisp/emacs-lisp/check-declare.el (check-declare-directory): Use 'grep-find-program', not 'find-program'. diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index b6fa054..b8a00b3 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -339,7 +339,7 @@ Returns non-nil if any false statements are found." errlist files) (message "%s" m) (message "%s" m2) - (setq files (process-lines find-program root + (setq files (process-lines grep-find-program root "-name" "*.el" "-exec" grep-program "-l" "^[ \t]*(declare-function" "{}" ";")) commit a8560e56a863d55f0df6e5c7da55d9a93286f772 Author: Eli Zaretskii Date: Sat Apr 16 14:20:34 2016 +0300 Improve "C-h S" for cl-lib symbols * lisp/info-look.el: Add cl.info lookup to emacs-lisp-mode related manuals. (Bug#23289) diff --git a/lisp/info-look.el b/lisp/info-look.el index 70d2756..899f41e 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -912,7 +912,9 @@ Return nil if there is nothing appropriate in the buffer near point." ;; for things that should go to Function: etc, and those latter ;; are much more important. Perhaps this could change if some ;; sort of fallback match scheme existed. - ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)"))) + ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)") + ("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)") + ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)"))) ;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode (info-lookup-maybe-add-help commit 52e798b7cd6626d83622206839ddaf7353e4f942 Author: Eli Zaretskii Date: Sat Apr 16 13:53:17 2016 +0300 Fix minor issues with removing left or right fringes * lisp/window.el (window-max-chars-per-line): Account for 'left-fringe-width' and 'right-fringe-width' variables. * doc/lispref/windows.texi (Window Sizes): Document the effect on window text width when setting the width of one or both fringes to zero. * doc/emacs/display.texi (Fringes): Document the effect on window text width when setting the width of one or both fringes to zero. (Bug#22891) diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 01f899f..8039291 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1087,6 +1087,23 @@ To disable this, change the variable @code{overflow-newline-into-fringe} to @code{nil}; this causes Emacs to continue or truncate lines that are exactly as wide as the window. + If you customize @code{fringe-mode} to remove the fringes on one or +both sides of the window display, the features that display on the +fringe are not available. Indicators of line continuation and +truncation are an exception: when fringes are not available, Emacs +uses the leftmost and rightmost character cells to indicate +continuation and truncation with special ASCII characters, see +@ref{Continuation Lines}, and @ref{Line Truncation}. This reduces the +width available for displaying text on each line, because the +character cells used for truncation and continuation indicators are +reserved for that purpose. Since buffer text can include +bidirectional text, and thus both left-to-right and right-to-left +paragraphs (@pxref{Bidirectional Editing}), removing only one of the +fringes still reserves two character cells, one on each side of the +window, for truncation and continuation indicators, because these +indicators are displayed on opposite sides of the window in +right-to-left paragraphs. + @node Displaying Boundaries @section Displaying Boundaries diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index f61f08a..0665eb9 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -605,6 +605,12 @@ exceed its total height as returned by @code{window-total-height}. @cindex body width of a window The @dfn{body width} of a window is the width of its text area, which does not include the scroll bar, fringes, margins or a right divider. +Note that when one or both fringes are removed (by setting their width +to zero), the display engine reserves two character cells, one on each +side of the window, for displaying the continuation and truncation +glyphs, which leaves 2 columns less for text display. (The function +@code{window-max-chars-per-line}, described below, takes this +peculiarity into account.) @defun window-body-width &optional window pixelwise This function returns the width, in columns, of the body of window diff --git a/lisp/window.el b/lisp/window.el index 7e46aa8..fd0fcc9 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1889,9 +1889,19 @@ the font." (ncols (/ window-width font-width))) (if (and (display-graphic-p) overflow-newline-into-fringe - (/= (frame-parameter nil 'left-fringe) 0) - (/= (frame-parameter nil 'right-fringe) 0)) + (not + (or (eq left-fringe-width 0) + (and (null left-fringe-width) + (= (frame-parameter nil 'left-fringe) 0)))) + (not + (or (eq right-fringe-width 0) + (and (null right-fringe-width) + (= (frame-parameter nil 'right-fringe) 0))))) ncols + ;; FIXME: This should remove 1 more column when there are no + ;; fringes, lines are truncated, and the window is hscrolled, + ;; but EOL is not in the view, because then there are 2 + ;; truncation glyphs, not one. (1- ncols))))) (defun window-current-scroll-bars (&optional window) commit d6ffd645a83d38a1e59321f8c73b4fd19e84b4c5 Author: Eli Zaretskii Date: Sat Apr 16 13:08:30 2016 +0300 Speed up redisplay in ansi-term mode * lisp/term.el (ansi-term): Force L2R 'bidi-paragraph-direction'. (Bug#20611) diff --git a/lisp/term.el b/lisp/term.el index 6fd3a5e..8cdf0c0 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -4151,7 +4151,17 @@ the process. Any more args are arguments to PROGRAM." ;; .emacs ... (term-set-escape-char ?\C-x)) - (switch-to-buffer term-ansi-buffer-name)) + (switch-to-buffer term-ansi-buffer-name) + ;; For some reason, without the below setting, ansi-term behaves + ;; sluggishly, not clear why, since the buffer is typically very + ;; small. + ;; + ;; There's a larger problem here with supporting bidirectional text: + ;; the application that writes to the terminal could have its own + ;; ideas about displaying bidirectional text, and might not want us + ;; reordering the text or deciding on base paragraph direction. One + ;; such application is Emacs in TTY mode... FIXME. + (setq bidi-paragraph-direction 'left-to-right)) ;;; Serial terminals commit 4ab671c48c6dbec0515797186081cb96cc387c10 Author: Philipp Stephani Date: Sat Apr 16 12:55:17 2016 +0300 Simplify 8-bit character handling by terminal for 'raw-text' * lisp/international/mule.el (set-keyboard-coding-system): Treat 'raw-text' as another coding type that requires 8-bit characters. * lisp/xt-mouse.el (xterm-mouse--read-coordinate): Use 'no-conversion' instead of 'latin-1'. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 60a90ae..21ab7e1 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -1445,42 +1445,35 @@ graphical terminals." (let ((coding-type (coding-system-type coding-system)) (saved-meta-mode (terminal-parameter terminal 'keyboard-coding-saved-meta-mode))) - (if (not (eq coding-type 'raw-text)) - (let (accept-8-bit) - (if (not (or (coding-system-get coding-system :suitable-for-keyboard) - (coding-system-get coding-system :ascii-compatible-p))) - (error "Unsuitable coding system for keyboard: %s" coding-system)) - (cond ((memq coding-type '(charset utf-8 shift-jis big5 ccl)) - (setq accept-8-bit t)) - ((eq coding-type 'iso-2022) - (let ((flags (coding-system-get coding-system :flags))) - (or (memq '7-bit flags) - (setq accept-8-bit t)))) - (t - (error "Unsupported coding system for keyboard: %s" - coding-system))) - (if accept-8-bit - (progn - (or saved-meta-mode - (set-terminal-parameter terminal - 'keyboard-coding-saved-meta-mode - (cons (nth 2 (current-input-mode)) - nil))) - (set-input-meta-mode 8 terminal)) - (when saved-meta-mode - (set-input-meta-mode (car saved-meta-mode) terminal) - (set-terminal-parameter terminal - 'keyboard-coding-saved-meta-mode - nil))) - ;; Avoid end-of-line conversion. - (setq coding-system - (coding-system-change-eol-conversion coding-system 'unix))) - - (when saved-meta-mode - (set-input-meta-mode (car saved-meta-mode) terminal) - (set-terminal-parameter terminal - 'keyboard-coding-saved-meta-mode - nil)))) + (let (accept-8-bit) + (if (not (or (coding-system-get coding-system :suitable-for-keyboard) + (coding-system-get coding-system :ascii-compatible-p))) + (error "Unsuitable coding system for keyboard: %s" coding-system)) + (cond ((memq coding-type '(raw-text charset utf-8 shift-jis big5 ccl)) + (setq accept-8-bit t)) + ((eq coding-type 'iso-2022) + (let ((flags (coding-system-get coding-system :flags))) + (or (memq '7-bit flags) + (setq accept-8-bit t)))) + (t + (error "Unsupported coding system for keyboard: %s" + coding-system))) + (if accept-8-bit + (progn + (or saved-meta-mode + (set-terminal-parameter terminal + 'keyboard-coding-saved-meta-mode + (cons (nth 2 (current-input-mode)) + nil))) + (set-input-meta-mode 8 terminal)) + (when saved-meta-mode + (set-input-meta-mode (car saved-meta-mode) terminal) + (set-terminal-parameter terminal + 'keyboard-coding-saved-meta-mode + nil))) + ;; Avoid end-of-line conversion. + (setq coding-system + (coding-system-change-eol-conversion coding-system 'unix)))) (set-keyboard-coding-system-internal coding-system terminal) (setq keyboard-coding-system coding-system)) diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index e520957..a2b6401 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -155,10 +155,7 @@ single byte." (set-keyboard-coding-system (if (terminal-parameter nil 'xterm-mouse-utf-8) 'utf-8-unix - ;; Use Latin-1 instead of no-conversion to avoid flicker - ;; due to `set-keyboard-coding-system' changing the meta - ;; mode. - 'latin-1)) + 'no-conversion)) ;; Wait only a little; we assume that the entire escape sequence ;; has already been sent when this function is called. (read-char nil nil 0.1)) commit f3653ec446ed95404889cf16c67b2d96b3955f52 Author: Glenn Morris Date: Fri Apr 15 19:19:47 2016 -0400 * configure.ac (HAVE_MODULES): Treat gnu like gnu-linux. (Bug#22722) diff --git a/configure.ac b/configure.ac index d31b8df..d803363 100644 --- a/configure.ac +++ b/configure.ac @@ -3336,24 +3336,26 @@ HAVE_MODULES=no MODULES_OBJ= MODULES_SUFFIX= if test "${with_modules}" != "no"; then - if test "$opsys" = "gnu-linux"; then - LIBMODULES="-ldl" - MODULES_SUFFIX=".so" - HAVE_MODULES=yes - elif test "$opsys" = "cygwin"; then - MODULES_SUFFIX=".dll" - HAVE_MODULES=yes - elif test "$opsys" = "darwin"; then - MODULES_SUFFIX=".so" - HAVE_MODULES=yes - elif test "$opsys" = "mingw32"; then - MODULES_SUFFIX=".dll" - HAVE_MODULES=yes - else - # BSD system have dlopen in the libc - AC_CHECK_FUNC(dlopen, [MODULES_SUFFIX=".so"] - [HAVE_MODULES=yes], []) - fi + case $opsys in + gnu*) + LIBMODULES="-ldl" + MODULES_SUFFIX=".so" + HAVE_MODULES=yes + ;; + cygwin|mingw32) + MODULES_SUFFIX=".dll" + HAVE_MODULES=yes + ;; + darwin) + MODULES_SUFFIX=".so" + HAVE_MODULES=yes + ;; + *) + # BSD system have dlopen in the libc + AC_CHECK_FUNC(dlopen, [MODULES_SUFFIX=".so"] + [HAVE_MODULES=yes], []) + ;; + esac if test "${HAVE_MODULES}" = no; then AC_MSG_ERROR([Dynamic modules are not supported on your system]) commit ab849b7fac5f7a4bb301eb830fa0acc3ad18c18f Author: Eli Zaretskii Date: Fri Apr 15 17:26:37 2016 +0300 Fix w32 memory-management problem when extending buffer text * src/w32heap.c (mmap_realloc): Only attempt extending a region if the following region has the same allocation base. Also, use the original allocation base and enlarged size to commit reserved memory, to ensure that the allocation base stays at its original value. This fixes several hard-to-debug problems whereby part of buffer text was overwritten with binary nulls, because mmap_realloc copied only part of buffer text when extending it. See http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00325.html and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23223#55 for two examples of the related problems. diff --git a/src/w32heap.c b/src/w32heap.c index df2fe0a..6643b43 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -714,13 +714,12 @@ mmap_realloc (void **var, size_t nbytes) /* If there is enough room in the current reserved area, then commit more pages as needed. */ if (m2.State == MEM_RESERVE + && m2.AllocationBase == memInfo.AllocationBase && nbytes <= memInfo.RegionSize + m2.RegionSize) { void *p; - p = VirtualAlloc (*var + memInfo.RegionSize, - nbytes - memInfo.RegionSize, - MEM_COMMIT, PAGE_READWRITE); + p = VirtualAlloc (*var, nbytes, MEM_COMMIT, PAGE_READWRITE); if (!p /* && GetLastError() != ERROR_NOT_ENOUGH_MEMORY */) { DebPrint (("realloc enlarge: VirtualAlloc (%p + %I64x, %I64x) error %ld\n", @@ -728,7 +727,8 @@ mmap_realloc (void **var, size_t nbytes) (uint64_t)(nbytes - memInfo.RegionSize), GetLastError ())); DebPrint (("next region: %p %p %I64x %x\n", m2.BaseAddress, - m2.AllocationBase, m2.RegionSize, m2.AllocationProtect)); + m2.AllocationBase, (uint64_t)m2.RegionSize, + m2.AllocationProtect)); } else return *var; commit 1b98a68b660501c44d3a142a12ee35e3c215b05a Author: Michael Albinus Date: Thu Apr 14 20:28:18 2016 +0200 Fix Bug#20637. Do not merge to master * lisp/vc/vc-hooks.el (vc-state, vc-working-revision): Use `vc-backend' instead of `vc-responsible-backend'. (Bug#20637) * test/automated/vc-tests.el (vc-test--state) (vc-test--working-revision): Deactivate now failing checks. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 0826744..4b5ec27 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -476,7 +476,7 @@ status of this file. Otherwise, the value returned is one of: ;; - `copied' and `moved' (might be handled by `removed' and `added') (or (vc-file-getprop file 'vc-state) (when (> (length file) 0) ;Why?? --Stef - (setq backend (or backend (vc-responsible-backend file))) + (setq backend (or backend (vc-backend file))) (when backend (vc-state-refresh file backend))))) @@ -495,7 +495,7 @@ status of this file. Otherwise, the value returned is one of: If FILE is not registered, this function always returns nil." (or (vc-file-getprop file 'vc-working-revision) (progn - (setq backend (or backend (vc-responsible-backend file))) + (setq backend (or backend (vc-backend file))) (when backend (vc-file-setprop file 'vc-working-revision (vc-call-backend backend 'working-revision file)))))) diff --git a/test/automated/vc-tests.el b/test/automated/vc-tests.el index 2faa143..5042196 100644 --- a/test/automated/vc-tests.el +++ b/test/automated/vc-tests.el @@ -290,8 +290,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unregistered: CVS SCCS SRC ;; up-to-date: Bzr SVN (message "vc-state1 %s" (vc-state default-directory)) - (should (eq (vc-state default-directory) - (vc-state default-directory backend))) + ;;(should (eq (vc-state default-directory) + ;;(vc-state default-directory backend))) (should (memq (vc-state default-directory) '(nil added unregistered up-to-date))) @@ -303,7 +303,7 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unregistered: RCS SCCS ;; up-to-date: Bzr CVS (message "vc-state2 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) + ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) (should (memq (vc-state tmp-name) '(nil added unregistered up-to-date))) @@ -315,7 +315,7 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unregistered: Hg RCS SCCS SRC SVN ;; up-to-date: Bzr CVS (message "vc-state3 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) + ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) (should (memq (vc-state tmp-name) '(nil added unregistered up-to-date))) @@ -327,8 +327,9 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unregistered: Hg RCS SCCS SRC SVN ;; up-to-date: Bzr CVS (message "vc-state4 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) '(added unregistered up-to-date))) + ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) + (should (memq (vc-state tmp-name) + '(nil added unregistered up-to-date))) ;; Unregister the file. Check state. (condition-case nil @@ -340,9 +341,9 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unsupported: CVS Mtn SCCS SRC SVN ;; up-to-date: Bzr (message "vc-state5 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) + ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) (should (memq (vc-state tmp-name) - '(added unregistered up-to-date)))) + '(nil added unregistered up-to-date)))) (vc-not-supported (message "vc-state5 unsupported"))))) ;; Save exit. @@ -374,8 +375,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; "0": Bzr Hg SRC SVN (message "vc-working-revision1 %s" (vc-working-revision default-directory)) - (should (eq (vc-working-revision default-directory) - (vc-working-revision default-directory backend))) + ;;(should (eq (vc-working-revision default-directory) + ;;(vc-working-revision default-directory backend))) (should (member (vc-working-revision default-directory) '(nil "0"))) (let ((tmp-name (expand-file-name "foo" default-directory))) @@ -385,8 +386,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; nil: CVS Git Mtn RCS SCCS SVN ;; "0": Bzr Hg SRC (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) + ;;(should (eq (vc-working-revision tmp-name) + ;;(vc-working-revision tmp-name backend))) (should (member (vc-working-revision tmp-name) '(nil "0"))) ;; Write a new file. Check working revision. @@ -395,8 +396,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; nil: CVS Git Mtn RCS SCCS SVN ;; "0": Bzr Hg SRC (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) + ;;(should (eq (vc-working-revision tmp-name) + ;;(vc-working-revision tmp-name backend))) (should (member (vc-working-revision tmp-name) '(nil "0"))) ;; Register a file. Check working revision. @@ -406,8 +407,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; nil: Mtn Git RCS SCCS ;; "0": Bzr CVS Hg SRC SVN (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) + ;;(should (eq (vc-working-revision tmp-name) + ;;(vc-working-revision tmp-name backend))) (should (member (vc-working-revision tmp-name) '(nil "0"))) ;; Unregister the file. Check working revision. @@ -420,8 +421,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; unsupported: CVS Mtn SCCS SRC SVN (message "vc-working-revision5 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) + ;;(should (eq (vc-working-revision tmp-name) + ;;(vc-working-revision tmp-name backend))) (should (member (vc-working-revision tmp-name) '(nil "0")))) (vc-not-supported (message "vc-working-revision5 unsupported"))))) commit 32364bbbaa8bda68228a3b0191c0b340c252d2a2 Author: Paul Eggert Date: Thu Apr 14 08:21:34 2016 -0700 substitute-command-keys keeps quotes’ text props Problem reported by Clément Pit--Claudel (Bug#23254). * src/doc.c: Include intervals.h. (Fsubstitute_command_keys): If the only substitutions are for quotes, copy the source string’s text properties too, since no substring lengths have changed. diff --git a/src/doc.c b/src/doc.c index 1d46661..7cdb0d0 100644 --- a/src/doc.c +++ b/src/doc.c @@ -34,6 +34,7 @@ along with GNU Emacs. If not, see . */ #include "coding.h" #include "buffer.h" #include "disptab.h" +#include "intervals.h" #include "keymap.h" /* Buffer used for reading from documentation file. */ @@ -739,6 +740,7 @@ Otherwise, return a new string. */) { char *buf; bool changed = false; + bool nonquotes_changed = false; unsigned char *strp; char *bufp; ptrdiff_t idx; @@ -786,7 +788,7 @@ Otherwise, return a new string. */) { /* \= quotes the next character; thus, to put in \[ without its special meaning, use \=\[. */ - changed = true; + changed = nonquotes_changed = true; strp += 2; if (multibyte) { @@ -946,6 +948,8 @@ Otherwise, return a new string. */) length = SCHARS (tem); length_byte = SBYTES (tem); subst: + nonquotes_changed = true; + subst_quote: changed = true; { ptrdiff_t offset = bufp - buf; @@ -967,7 +971,7 @@ Otherwise, return a new string. */) length = 1; length_byte = sizeof uLSQM - 1; idx = strp - SDATA (string) + 1; - goto subst; + goto subst_quote; } else if (strp[0] == '`' && quoting_style == STRAIGHT_QUOTING_STYLE) { @@ -1003,7 +1007,22 @@ Otherwise, return a new string. */) } if (changed) /* don't bother if nothing substituted */ - tem = make_string_from_bytes (buf, nchars, bufp - buf); + { + tem = make_string_from_bytes (buf, nchars, bufp - buf); + if (!nonquotes_changed) + { + /* Nothing has changed other than quoting, so copy the string’s + text properties. FIXME: Text properties should survive other + changes too. */ + INTERVAL interval_copy = copy_intervals (string_intervals (string), + 0, SCHARS (string)); + if (interval_copy) + { + set_interval_object (interval_copy, tem); + set_string_intervals (tem, interval_copy); + } + } + } else tem = string; xfree (buf); commit 567ab529f313bc8fe68d25b2ca95f5987cce81a1 Author: YAMAMOTO Mitsuharu Date: Thu Apr 14 07:47:55 2016 +0900 * src/xwidget.c (x_draw_xwidget_glyph_string): More clipping fixes. diff --git a/src/xwidget.c b/src/xwidget.c index 7e96307..82449f7 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -580,20 +580,14 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) int text_area_x, text_area_y, text_area_width, text_area_height; - window_box (s->w, - ANY_AREA, - &text_area_x, - &text_area_y, - &text_area_width, - &text_area_height); - clip_right = min (xww->width, - text_area_width); - clip_left = max (0, - text_area_x); - - clip_bottom = min (xww->height, - text_area_height); - clip_top = max (0, text_area_y); + window_box (s->w, TEXT_AREA, &text_area_x, &text_area_y, + &text_area_width, &text_area_height); + clip_left = max (0, text_area_x - x); + clip_right = max (clip_left, + min (xww->width, text_area_x + text_area_width - x)); + clip_top = max (0, text_area_y - y); + clip_bottom = max (clip_top, + min (xww->height, text_area_y + text_area_height - y)); /* We are concerned with movement of the onscreen area. The area might sit still when the widget actually moves. This happens @@ -622,8 +616,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) || xv->clip_bottom != clip_bottom || xv->clip_top != clip_top || xv->clip_left != clip_left) { - gtk_widget_set_size_request (xv->widgetwindow, clip_right + clip_left, - clip_bottom + clip_top); + gtk_widget_set_size_request (xv->widgetwindow, clip_right - clip_left, + clip_bottom - clip_top); gtk_fixed_move (GTK_FIXED (xv->widgetwindow), xv->widget, -clip_left, -clip_top); commit 24b87a1d4aadbdeafbc0db17e3a760cc9a7e21ef Author: Dmitry Gutov Date: Tue Apr 12 21:46:22 2016 +0300 Add semantic-symref-filepattern-alist entry for lisp-interaction-mode * lisp/cedet/semantic/symref/grep.el (semantic-symref-filepattern-alist): Add entry for lisp-interaction-mode (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23223#47) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 868e6c3..36e97da 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -50,6 +50,7 @@ and those hits returned.") "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") (perl-mode "*.pl" "*.PL") (cperl-mode "*.pl" "*.PL") + (lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs") ) "List of major modes and file extension pattern. See find -name man page for format.") commit cc0b713210a4ae3e273571f8c829122db2b143cf Author: Dmitry Gutov Date: Tue Apr 12 21:08:22 2016 +0300 Perform xref searches without visiting unopened files * lisp/progmodes/xref.el (xref-collect-references): Instead of calling `semantic-symref-find-references-by-name', use `semantic-symref-instantiate' and `semantic-symref-perform-search' directly. Ask for `line-and-text' results (bug#23223). (xref-collect-matches): Include the line text in the "hit" structure. (xref--convert-hits): New function, split off from `xref-collect-references' and `xref-collect-matches', to convert "hits" to xref instance list. Create a temporary buffer here, to use it for post-processing all hit lines. (xref--collect-matches): Use a different approach for non-visited files. Insert the line text into the temp buffer, apply the file's major mode the best we can without reading its whole contents, syntax-propertize, and search in the result. (xref--collect-matches-1): Extract, to handle the common logic between two cases. (xref--find-buffer-visiting): New function, a wrapper around `find-buffer-visiting' to amortize its cost. * lisp/cedet/semantic/symref/idutils.el (semantic-symref-idutils--line-re): New constant. (semantic-symref-parse-tool-output-one-line): Support result type `line-and-text'. * lisp/cedet/semantic/symref/grep.el (semantic-symref-grep--line-re) (semantic-symref-parse-tool-output-one-line): Same. * lisp/cedet/semantic/symref/cscope.el (semantic-symref-cscope--line-re) (semantic-symref-parse-tool-output-one-line): Same. * lisp/cedet/semantic/symref/global.el (semantic-symref-global--line-re) (semantic-symref-parse-tool-output-one-line): Same. diff --git a/lisp/cedet/semantic/symref/cscope.el b/lisp/cedet/semantic/symref/cscope.el index 4890b5b..3abd8b3 100644 --- a/lisp/cedet/semantic/symref/cscope.el +++ b/lisp/cedet/semantic/symref/cscope.el @@ -60,6 +60,9 @@ See the function `cedet-cscope-search' for more details.") (semantic-symref-parse-tool-output tool b) )) +(defconst semantic-symref-cscope--line-re + "^\\([^ ]+\\) [^ ]+ \\([0-9]+\\) ") + (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-cscope)) "Parse one line of grep output, and return it as a match list. Moves cursor to end of the match." @@ -78,8 +81,13 @@ Moves cursor to end of the match." ;; We have to return something at this point. subtxt))) ) - (t - (when (re-search-forward "^\\([^ ]+\\) [^ ]+ \\([0-9]+\\) " nil t) + ((eq (oref tool :resulttype) 'line-and-text) + (when (re-search-forward semantic-symref-cscope--line-re nil t) + (list (string-to-number (match-string 2)) + (expand-file-name (match-string 1)) + (buffer-substring-no-properties (point) (line-end-position))))) + (t ; :resulttype is 'line + (when (re-search-forward semantic-symref-cscope--line-re nil t) (cons (string-to-number (match-string 2)) (expand-file-name (match-string 1))) )))) diff --git a/lisp/cedet/semantic/symref/global.el b/lisp/cedet/semantic/symref/global.el index e4c114e..a33427e 100644 --- a/lisp/cedet/semantic/symref/global.el +++ b/lisp/cedet/semantic/symref/global.el @@ -49,6 +49,9 @@ See the function `cedet-gnu-global-search' for more details.") (semantic-symref-parse-tool-output tool b) )) +(defconst semantic-symref-global--line-re + "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) ") + (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-global)) "Parse one line of grep output, and return it as a match list. Moves cursor to end of the match." @@ -57,8 +60,13 @@ Moves cursor to end of the match." ;; Search for files (when (re-search-forward "^\\([^\n]+\\)$" nil t) (match-string 1))) + ((eq (oref tool :resulttype) 'line-and-text) + (when (re-search-forward semantic-symref-global--line-re nil t) + (list (string-to-number (match-string 2)) + (match-string 3) + (buffer-substring-no-properties (point) (line-end-position))))) (t - (when (re-search-forward "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) " nil t) + (when (re-search-forward semantic-symref-global--line-re nil t) (cons (string-to-number (match-string 2)) (match-string 3)) )))) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 5d1fea8..868e6c3 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -188,6 +188,9 @@ This shell should support pipe redirect syntax." ;; Return the answer ans)) +(defconst semantic-symref-grep--line-re + "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):") + (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep)) "Parse one line of grep output, and return it as a match list. Moves cursor to end of the match." @@ -195,8 +198,13 @@ Moves cursor to end of the match." ;; Search for files (when (re-search-forward "^\\([^\n]+\\)$" nil t) (match-string 1))) + ((eq (oref tool :resulttype) 'line-and-text) + (when (re-search-forward semantic-symref-grep--line-re nil t) + (list (string-to-number (match-string 2)) + (match-string 1) + (buffer-substring-no-properties (point) (line-end-position))))) (t - (when (re-search-forward "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):" nil t) + (when (re-search-forward semantic-symref-grep--line-re nil t) (cons (string-to-number (match-string 2)) (match-string 1)) )))) diff --git a/lisp/cedet/semantic/symref/idutils.el b/lisp/cedet/semantic/symref/idutils.el index 4127d7a..db3e9a0 100644 --- a/lisp/cedet/semantic/symref/idutils.el +++ b/lisp/cedet/semantic/symref/idutils.el @@ -49,6 +49,9 @@ See the function `cedet-idutils-search' for more details.") (semantic-symref-parse-tool-output tool b) )) +(defconst semantic-symref-idutils--line-re + "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):") + (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-idutils)) "Parse one line of grep output, and return it as a match list. Moves cursor to end of the match." @@ -59,8 +62,13 @@ Moves cursor to end of the match." ((eq (oref tool :searchtype) 'tagcompletions) (when (re-search-forward "^\\([^ ]+\\) " nil t) (match-string 1))) - (t - (when (re-search-forward "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):" nil t) + ((eq (oref tool :resulttype) 'line-and-text) + (when (re-search-forward semantic-symref-idutils--line-re nil t) + (list (string-to-number (match-string 2)) + (expand-file-name (match-string 1) default-directory) + (buffer-substring-no-properties (point) (line-end-position))))) + (t ; resulttype is line + (when (re-search-forward semantic-symref-idutils--line-re nil t) (cons (string-to-number (match-string 2)) (expand-file-name (match-string 1) default-directory)) )))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index feed0fb..f674c70 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -839,16 +839,16 @@ and just use etags." (kill-local-variable 'xref-backend-functions)) (setq-local xref-backend-functions xref-etags-mode--saved))) -(declare-function semantic-symref-find-references-by-name "semantic/symref") -(declare-function semantic-find-file-noselect "semantic/fw") +(declare-function semantic-symref-instantiate "semantic/symref") +(declare-function semantic-symref-perform-search "semantic/symref") (declare-function grep-expand-template "grep") (defvar ede-minor-mode) ;; ede.el (defun xref-collect-references (symbol dir) "Collect references to SYMBOL inside DIR. This function uses the Semantic Symbol Reference API, see -`semantic-symref-find-references-by-name' for details on which -tools are used, and when." +`semantic-symref-tool-alist' for details on which tools are used, +and when." (cl-assert (directory-name-p dir)) (require 'semantic/symref) (defvar semantic-symref-tool) @@ -859,19 +859,19 @@ tools are used, and when." ;; to force the backend to use `default-directory'. (let* ((ede-minor-mode nil) (default-directory dir) + ;; FIXME: Remove CScope and Global from the recognized tools? + ;; The current implementations interpret the symbol search as + ;; "find all calls to the given function", but not function + ;; definition. And they return nothing when passed a variable + ;; name, even a global one. (semantic-symref-tool 'detect) (case-fold-search nil) - (res (semantic-symref-find-references-by-name symbol 'subdirs)) - (hits (and res (oref res hit-lines))) - (orig-buffers (buffer-list))) - (unwind-protect - (cl-mapcan (lambda (hit) (xref--collect-matches - hit (format "\\_<%s\\_>" (regexp-quote symbol)))) - hits) - ;; TODO: Implement "lightweight" buffer visiting, so that we - ;; don't have to kill them. - (mapc #'kill-buffer - (cl-set-difference (buffer-list) orig-buffers))))) + (inst (semantic-symref-instantiate :searchfor symbol + :searchtype 'symbol + :searchscope 'subdirs + :resulttype 'line-and-text))) + (xref--convert-hits (semantic-symref-perform-search inst) + (format "\\_<%s\\_>" (regexp-quote symbol))))) ;;;###autoload (defun xref-collect-matches (regexp files dir ignores) @@ -890,34 +890,19 @@ IGNORES is a list of glob patterns." files (expand-file-name dir) ignores)) - (orig-buffers (buffer-list)) (buf (get-buffer-create " *xref-grep*")) (grep-re (caar grep-regexp-alist)) - (counter 0) - reporter hits) (with-current-buffer buf (erase-buffer) (call-process-shell-command command nil t) (goto-char (point-min)) (while (re-search-forward grep-re nil t) - (push (cons (string-to-number (match-string 2)) - (match-string 1)) + (push (list (string-to-number (match-string 2)) + (match-string 1) + (buffer-substring-no-properties (point) (line-end-position))) hits))) - (setq reporter (make-progress-reporter - (format "Collecting search results...") - 0 (length hits))) - (unwind-protect - (cl-mapcan (lambda (hit) - (prog1 - (progress-reporter-update reporter counter) - (cl-incf counter)) - (xref--collect-matches hit regexp)) - (nreverse hits)) - (progress-reporter-done reporter) - ;; TODO: Same as above. - (mapc #'kill-buffer - (cl-set-difference (buffer-list) orig-buffers))))) + (xref--convert-hits hits regexp))) (defun xref--rgrep-command (regexp files dir ignores) (require 'find-dired) ; for `find-name-arg' @@ -980,30 +965,71 @@ directory, used as the root of the ignore globs." (match-string 1 str))))) str t t)) -(defun xref--collect-matches (hit regexp) - (pcase-let* ((`(,line . ,file) hit) - (buf (or (find-buffer-visiting file) - (semantic-find-file-noselect file)))) - (with-current-buffer buf - (save-excursion +(defvar xref--last-visiting-buffer nil) +(defvar xref--temp-buffer-file-name nil) + +(defun xref--convert-hits (hits regexp) + (let (xref--last-visiting-buffer + (tmp-buffer (generate-new-buffer " *xref-temp*"))) + (unwind-protect + (cl-mapcan (lambda (hit) (xref--collect-matches hit regexp tmp-buffer)) + hits) + (kill-buffer tmp-buffer)))) + +(defun xref--collect-matches (hit regexp tmp-buffer) + (pcase-let* ((`(,line ,file ,text) hit) + (buf (xref--find-buffer-visiting file))) + (if buf + (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (forward-line (1- line)) + (xref--collect-matches-1 regexp file line + (line-beginning-position) + (line-end-position)))) + ;; Using the temporary buffer is both a performance and a buffer + ;; management optimization. + (with-current-buffer tmp-buffer + (erase-buffer) + (unless (equal file xref--temp-buffer-file-name) + (insert-file-contents file nil 0 200) + ;; Can't (setq-local delay-mode-hooks t) because of + ;; bug#23272, but the performance penalty seems minimal. + (let ((buffer-file-name file) + (inhibit-message t) + message-log-max) + (ignore-errors + (set-auto-mode t))) + (setq-local xref--temp-buffer-file-name file) + (setq-local inhibit-read-only t) + (erase-buffer)) + (insert text) (goto-char (point-min)) - (forward-line (1- line)) - (let ((line-end (line-end-position)) - (line-beg (line-beginning-position)) - matches) - (syntax-propertize line-end) - ;; FIXME: This results in several lines with the same - ;; summary. Solve with composite pattern? - (while (re-search-forward regexp line-end t) - (let* ((beg-column (- (match-beginning 0) line-beg)) - (end-column (- (match-end 0) line-beg)) - (loc (xref-make-file-location file line beg-column)) - (summary (buffer-substring line-beg line-end))) - (add-face-text-property beg-column end-column 'highlight - t summary) - (push (xref-make-match summary loc (- end-column beg-column)) - matches))) - (nreverse matches)))))) + (xref--collect-matches-1 regexp file line + (point) + (point-max)))))) + +(defun xref--collect-matches-1 (regexp file line line-beg line-end) + (let (matches) + (syntax-propertize line-end) + ;; FIXME: This results in several lines with the same + ;; summary. Solve with composite pattern? + (while (re-search-forward regexp line-end t) + (let* ((beg-column (- (match-beginning 0) line-beg)) + (end-column (- (match-end 0) line-beg)) + (loc (xref-make-file-location file line beg-column)) + (summary (buffer-substring line-beg line-end))) + (add-face-text-property beg-column end-column 'highlight + t summary) + (push (xref-make-match summary loc (- end-column beg-column)) + matches))) + (nreverse matches))) + +(defun xref--find-buffer-visiting (file) + (unless (equal (car xref--last-visiting-buffer) file) + (setq xref--last-visiting-buffer + (cons file (find-buffer-visiting file)))) + (cdr xref--last-visiting-buffer)) (provide 'xref) commit 50455754b558d1689bbbb596e05631f2789b1350 Author: Phillip Lord Date: Tue Apr 12 18:00:50 2016 +0100 Revert "Prevent bootstrap autoload backup files" This reverts commit c23c965bb9d0a4bcc1b6158833ff99aa20fd53e9. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 592d69d..e688d6b 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -234,22 +234,9 @@ If a buffer is visiting the desired autoload file, return it." (enable-local-eval nil)) ;; We used to use `raw-text' to read this file, but this causes ;; problems when the file contains non-ASCII characters. - (let* ((delay-mode-hooks t) - (file (autoload-generated-file)) - (file-missing (not (file-exists-p file)))) - (when file-missing - (autoload-ensure-default-file file)) - (with-current-buffer - (find-file-noselect - (autoload-ensure-file-writeable - file)) - ;; block backups when the file has just been created, since - ;; the backups will just be the auto-generated headers. - ;; bug#23203 - (when file-missing - (setq buffer-backed-up t) - (save-buffer)) - (current-buffer))))) + (let ((delay-mode-hooks t)) + (find-file-noselect + (autoload-ensure-default-file (autoload-generated-file)))))) (defun autoload-generated-file () (expand-file-name generated-autoload-file @@ -370,22 +357,21 @@ not be relied upon." ;;;###autoload (put 'autoload-ensure-writable 'risky-local-variable t) -(defun autoload-ensure-file-writeable (file) - ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile, - ;; which was designed to handle CVSREAD=1 and equivalent. - (and autoload-ensure-writable - (let ((modes (file-modes file))) - (if (zerop (logand modes #o0200)) - ;; Ignore any errors here, and let subsequent attempts - ;; to write the file raise any real error. - (ignore-errors (set-file-modes file (logior modes #o0200)))))) - file) - (defun autoload-ensure-default-file (file) "Make sure that the autoload file FILE exists, creating it if needed. If the file already exists and `autoload-ensure-writable' is non-nil, make it writable." - (write-region (autoload-rubric file) nil file)) + (if (file-exists-p file) + ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile, + ;; which was designed to handle CVSREAD=1 and equivalent. + (and autoload-ensure-writable + (let ((modes (file-modes file))) + (if (zerop (logand modes #o0200)) + ;; Ignore any errors here, and let subsequent attempts + ;; to write the file raise any real error. + (ignore-errors (set-file-modes file (logior modes #o0200)))))) + (write-region (autoload-rubric file) nil file)) + file) (defun autoload-insert-section-header (outbuf autoloads load-name file time) "Insert the section-header line,