commit 4183482f4dd3c1a96c817d1598024952b82a7e59 (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Sun May 3 22:24:20 2015 -0400 * lisp/term/screen.el (xterm-screen-extra-capabilities): New custom (terminal-init-screen): Use it (bug#20356). * lisp/term/xterm.el: Provide `term/xterm' instead of `xterm'. (xterm--extra-capabilities-type): New const. (xterm-extra-capabilities): Use it. (xterm--version-handler): Lower the pseudo-version for `screen'. diff --git a/etc/NEWS b/etc/NEWS index 7497652..715295b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -238,6 +238,8 @@ Unicode standards. * Changes in Specialized Modes and Packages in Emacs 25.1 +** New `xterm-screen-extra-capabilities' config. + ** The `save-place' variable is replaced by a `save-place-mode'. ** Midnight-mode @@ -691,6 +693,11 @@ a typographically-correct documents. * Incompatible Lisp Changes in Emacs 25.1 +** `indirect-function' does not signal `void-function' any more. +This is mostly a bug-fix, since this change was missed back in 24.4 when +symbol-function was changed not to signal `void-function' any more. +*** As a consequence, the second arg of `indirect-function' is now obsolete. + ** Comint, term, and compile do not set the EMACS env var any more. Use the INSIDE_EMACS environment variable instead. diff --git a/lisp/term/screen.el b/lisp/term/screen.el index 3587c4f..41fd916 100644 --- a/lisp/term/screen.el +++ b/lisp/term/screen.el @@ -1,9 +1,22 @@ ;;; screen.el --- terminal initialization for screen and tmux -*- lexical-binding: t -*- ;; Copyright (C) 1995, 2001-2015 Free Software Foundation, Inc. +(require 'term/xterm) + +(defcustom xterm-screen-extra-capabilities '(modifyOtherKeys) + "Extra capabilities supported under \"screen\". +Some features of screen depend on the terminal emulator in which +it runs, which can change when the screen session is moved to another tty." + :type xterm--extra-capabilities-type + :group 'xterm) + (defun terminal-init-screen () "Terminal initialization function for screen." - ;; Treat a screen terminal similar to an xterm. - (tty-run-terminal-initialization (selected-frame) "xterm")) + ;; Treat a screen terminal similar to an xterm, but don't use + ;; xterm-extra-capabilities's `check' setting since that doesn't seem + ;; to work so well (it depends too much on the surrounding terminal + ;; emulator, which can change during the session, bug#20356). + (let ((xterm-extra-capabilities xterm-screen-extra-capabilities)) + (tty-run-terminal-initialization (selected-frame) "xterm"))) ;; screen.el ends here diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 726ecf9..79699c6 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -29,6 +29,13 @@ :version "24.1" :group 'terminals) +(defconst xterm--extra-capabilities-type + ;; NOTE: If you add entries here, make sure to update + ;; `terminal-init-xterm' as well. + '(set (const :tag "modifyOtherKeys support" modifyOtherKeys) + (const :tag "report background" reportBackground) + (const :tag "set X selection" setSelection))) + (defcustom xterm-extra-capabilities 'check "Whether Xterm supports some additional, more modern, features. If nil, just assume that it does not. @@ -40,13 +47,8 @@ The relevant features are: reportBackground -- if supported, Xterm reports its background color setSelection -- if supported, Xterm saves yanked text to the X selection" :version "24.1" - :type '(choice (const :tag "No" nil) - (const :tag "Check" check) - ;; NOTE: If you add entries here, make sure to update - ;; `terminal-init-xterm' as well. - (set (const :tag "modifyOtherKeys support" modifyOtherKeys) - (const :tag "report background" reportBackground) - (const :tag "set X selection" setSelection)))) + :type `(choice (const :tag "Check" check) + ,xterm--extra-capabilities-type)) (defcustom xterm-max-cut-length 100000 "Maximum number of bytes to cut into xterm using the OSC 52 sequence. @@ -623,8 +625,11 @@ string bytes that can be copied is 3/4 of this value." (setq version 200)) (when (equal (match-string 1 str) "83") ;; `screen' (which returns 83;40003;0) seems to also lack support for - ;; some of these (bug#17607). - (setq version 240)) + ;; some of these (bug#17607, bug#20356). + ;; Note: this code path should normally not be used any more + ;; since term/screen.el now binds xterm-extra-capabilities + ;; to a fixed value, rather than using the dynamic checking. + (setq version 200)) ;; If version is 242 or higher, assume the xterm supports ;; reporting the background color (TODO: maybe earlier ;; versions do too...) @@ -925,6 +930,6 @@ versions of xterm." (set-terminal-parameter nil 'background-mode 'dark) t)) -(provide 'xterm) - +(provide 'xterm) ;Backward compatibility. +(provide 'term/xterm) ;;; xterm.el ends here commit b7bb71c801ecd9afa09f260ca7dbe7a5677cf9e0 Author: Dmitry Gutov Date: Mon May 4 02:52:16 2015 +0300 ; xref--insert-xrefs: Add (require 'compile) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index de9dccf..b972bf2 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -509,6 +509,7 @@ meantime are preserved." XREF-ALIST is of the form ((GROUP . (XREF ...)) ...). Where GROUP is a string for decoration purposes and XREF is an `xref--xref' object." + (require 'compile) ;; For the compilation-info face. (cl-loop for ((group . xrefs) . more1) on xref-alist do (xref--insert-propertized '(face compilation-info) group "\n") (cl-loop for (xref . more2) on xrefs do commit bcfdfd2568463edf489784c1f44cf9b55e4f3892 Author: Dmitry Gutov Date: Mon May 4 00:39:06 2015 +0300 xref--insert-xrefs: Tweak the faces * lisp/progmodes/xref.el (xref--insert-xrefs): Tweak the faces. Always insert a newline at the end (to avoid mouse-face background tail at the last line). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 099c080..de9dccf 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -510,21 +510,20 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...). Where GROUP is a string for decoration purposes and XREF is an `xref--xref' object." (cl-loop for ((group . xrefs) . more1) on xref-alist do - (xref--insert-propertized '(face bold) group "\n") + (xref--insert-propertized '(face compilation-info) group "\n") (cl-loop for (xref . more2) on xrefs do (insert " ") (with-slots (description location) xref (xref--insert-propertized (list 'xref-location location - 'face 'font-lock-keyword-face + ;; 'face 'font-lock-keyword-face 'mouse-face 'highlight 'keymap xref--button-map 'help-echo (concat "mouse-2: display in another window, " "RET or mouse-1: follow reference")) description)) - (when (or more1 more2) - (insert "\n"))))) + (insert "\n")))) (defun xref--analyze (xrefs) "Find common filenames in XREFS. commit ac5586a1037bae49738607d19fd008cd93f49ae2 Author: Dmitry Gutov Date: Sun May 3 23:57:38 2015 +0300 elisp-completion-at-point: Prioritize being quoted over funpos * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Only consider function position when not inside quoted form (bug#20425). * test/automated/elisp-mode-tests.el: New file. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 2bb661a..7c9a2d7 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -475,11 +475,12 @@ It can be quoted, or be inside a quoted form." (point))) (scan-error pos)))) ;; t if in function position. - (funpos (eq (char-before beg) ?\())) + (funpos (eq (char-before beg) ?\()) + (quoted (elisp--form-quoted-p beg))) (when (and end (or (not (nth 8 (syntax-ppss))) (eq (char-before beg) ?`))) (let ((table-etc - (if (not funpos) + (if (or (not funpos) quoted) ;; FIXME: We could look at the first element of the list and ;; use it to provide a more specific completion table in some ;; cases. E.g. filter out keywords that are not understood by @@ -491,7 +492,7 @@ It can be quoted, or be inside a quoted form." :company-doc-buffer #'elisp--company-doc-buffer :company-docsig #'elisp--company-doc-string :company-location #'elisp--company-location)) - ((elisp--form-quoted-p beg) + (quoted (list nil obarray ;; Don't include all symbols (bug#16646). :predicate (lambda (sym) diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el new file mode 100644 index 0000000..a4148e9 --- /dev/null +++ b/test/automated/elisp-mode-tests.el @@ -0,0 +1,88 @@ +;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Dmitry Gutov + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) + +(defun elisp--test-completions () + (let ((data (elisp-completion-at-point))) + (all-completions (buffer-substring (nth 0 data) (nth 1 data)) + (nth 2 data) + (plist-get (nthcdr 3 data) :predicate)))) + +(ert-deftest elisp-completes-functions () + (with-temp-buffer + (emacs-lisp-mode) + (insert "(ba") + (let ((comps (elisp--test-completions))) + (should (member "backup-buffer" comps)) + (should-not (member "backup-inhibited" comps))))) + +(ert-deftest elisp-completes-variables () + (with-temp-buffer + (emacs-lisp-mode) + (insert "(foo ba") + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should-not (member "backup-buffer" comps))))) + +(ert-deftest elisp-completes-anything-quoted () + (dolist (text '("`(foo ba" "(foo 'ba" + "`(,foo ba" "`,(foo `ba" + "'(foo (ba")) + (with-temp-buffer + (emacs-lisp-mode) + (insert text) + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should (member "backup-buffer" comps)) + (should (member "backup" comps)))))) + +(ert-deftest elisp-completes-variables-unquoted () + (dolist (text '("`(foo ,ba" "`(,(foo ba" "`(,ba")) + (with-temp-buffer + (emacs-lisp-mode) + (insert text) + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should-not (member "backup-buffer" comps)))))) + +(ert-deftest elisp-completes-functions-in-special-macros () + (dolist (text '("(declare-function ba" "(cl-callf2 ba")) + (with-temp-buffer + (emacs-lisp-mode) + (insert text) + (let ((comps (elisp--test-completions))) + (should (member "backup-buffer" comps)) + (should-not (member "backup-inhibited" comps)))))) + +(ert-deftest elisp-completes-local-variables () + (with-temp-buffer + (emacs-lisp-mode) + (insert "(let ((bar 1) baz) (foo ba") + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should (member "bar" comps)) + (should (member "baz" comps))))) + +(provide 'elisp-mode-tests) +;;; elisp-mode-tests.el ends here commit 2703629711f29f6a46e2766c10df5df5863d2ab9 Author: Dmitry Gutov Date: Sun May 3 21:32:40 2015 +0300 Stop vc-print-log from jumping to the top * lisp/vc/vc.el (vc-print-log-internal): Pass nil GOTO-LOCATION-FUNC to vc-log-internal-common when WORKING-REVISION is not specified. (vc-incoming-outgoing-internal): Always pass nil. (vc-log-internal-common): When GOTO-LOCATION-FUNC is nil, don't call it, and don't set vc-sentinel-movepoint (bug#15322). (vc-print-root-log): Don't fetch the root working revision, nor pass it to vc-print-log-internal. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index bb4dd60..1a997a4 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2224,8 +2224,10 @@ earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." (lambda (_bk _files-arg ret) (vc-print-log-setup-buttons working-revision is-start-revision limit ret)) - (lambda (bk) - (vc-call-backend bk 'show-log-entry working-revision)) + ;; When it's nil, point really shouldn't move (bug#15322). + (when working-revision + (lambda (bk) + (vc-call-backend bk 'show-log-entry working-revision))) (lambda (_ignore-auto _noconfirm) (vc-print-log-internal backend files working-revision is-start-revision limit))))) @@ -2263,8 +2265,9 @@ earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." (let ((inhibit-read-only t)) (funcall setup-buttons-func backend files retval) (shrink-window-if-larger-than-buffer) - (funcall goto-location-func backend) - (setq vc-sentinel-movepoint (point)) + (when goto-location-func + (funcall goto-location-func backend) + (setq vc-sentinel-movepoint (point))) (set-buffer-modified-p nil))))) (defun vc-incoming-outgoing-internal (backend remote-location buffer-name type) @@ -2273,7 +2276,7 @@ earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." (lambda (bk buf type-arg _files) (vc-call-backend bk type-arg buf remote-location)) (lambda (_bk _files-arg _ret) nil) - (lambda (_bk) (goto-char (point-min))) + nil ;; Don't move point. (lambda (_ignore-auto _noconfirm) (vc-incoming-outgoing-internal backend remote-location buffer-name type)))) @@ -2328,16 +2331,15 @@ When called interactively with a prefix argument, prompt for LIMIT." (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) (let ((backend (vc-deduce-backend)) (default-directory default-directory) - rootdir working-revision) + rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) (setq rootdir (read-directory-name "Directory for VC root-log: ")) (setq backend (vc-responsible-backend rootdir)) (unless backend (error "Directory is not version controlled"))) - (setq working-revision (vc-working-revision rootdir) - default-directory rootdir) - (vc-print-log-internal backend (list rootdir) working-revision nil limit))) + (setq default-directory rootdir) + (vc-print-log-internal backend (list rootdir) nil nil limit))) ;;;###autoload (defun vc-log-incoming (&optional remote-location)