commit 6316435de740af0dce794740ba05382664c806f2 (HEAD, refs/remotes/origin/master) Author: Artur Malabarba Date: Wed Nov 19 00:47:36 2014 +0000 lisp/ido.el: New command `ido-bury-buffer-at-head' Bound to C-S-b Bury the buffer at the head of `ido-matches', analogous to how C-k kills the buffer at head. diff --git a/etc/NEWS b/etc/NEWS index 41b9324..c319a09 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -132,6 +132,10 @@ Unicode standards. * Changes in Specialized Modes and Packages in Emacs 25.1 +** ido +*** New command `ido-bury-buffer-at-head' bound to C-S-b +Bury the buffer at the head of `ido-matches', analogous to how C-k +kills the buffer at head. ** Minibuffer diff --git a/lisp/ido.el b/lisp/ido.el index bda2525..5f7637c 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1672,6 +1672,7 @@ This function also adds a hook to the minibuffer." (define-key map "\C-x\C-f" 'ido-enter-find-file) (define-key map "\C-x\C-b" 'ido-fallback-command) (define-key map "\C-k" 'ido-kill-buffer-at-head) + (define-key map [?\C-\S-b] 'ido-bury-buffer-at-head) (define-key map "\C-o" 'ido-toggle-virtual-buffers) (set-keymap-parent map ido-common-completion-map) (setq ido-buffer-completion-map map))) @@ -4026,6 +4027,20 @@ If cursor is not at the end of the user input, delete to end of input." (setq ido-cur-list (delete buf ido-cur-list)) (setq ido-rescan t)))))) +;;; BURY CURRENT BUFFER +(defun ido-bury-buffer-at-head () + "Bury the buffer at the head of `ido-matches'." + (interactive) + (let ((enable-recursive-minibuffers t) + (buf (ido-name (car ido-matches))) + (nextbuf (cadr ido-matches))) + (when (get-buffer buf) + (bury-buffer buf) + (setq ido-default-item nextbuf + ido-text-init ido-text + ido-exit 'refresh) + (exit-minibuffer)))) + ;;; DELETE CURRENT FILE (defun ido-delete-file-at-head () "Delete the file at the head of `ido-matches'. commit 4a306d701b0dbe860c8ced70e0d93bd3129f0665 Author: Juri Linkov Date: Wed Nov 19 00:23:47 2014 +0200 * lisp/simple.el (next-line-or-history-element): Wrap next-line in with-no-warnings. (previous-line-or-history-element): Wrap previous-line in with-no-warnings. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7763d25..8b7f62a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2014-11-18 Juri Linkov + * simple.el (next-line-or-history-element): Wrap next-line + in with-no-warnings. + (previous-line-or-history-element): Wrap previous-line + in with-no-warnings. + +2014-11-18 Juri Linkov + * progmodes/grep.el (grep-compute-defaults): Compute grep-highlight-matches before its use. diff --git a/lisp/simple.el b/lisp/simple.el index fda7040..2a47165 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1992,7 +1992,8 @@ next element of the minibuffer history in the minibuffer." (or arg (setq arg 1)) (let ((old-point (point))) (condition-case nil - (next-line arg) + (with-no-warnings + (next-line arg)) (end-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the end of the line when it fails to go to the next line. @@ -2007,7 +2008,8 @@ previous element of the minibuffer history in the minibuffer." (or arg (setq arg 1)) (let ((old-point (point))) (condition-case nil - (previous-line arg) + (with-no-warnings + (previous-line arg)) (beginning-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. commit 239aa11e1eeb1aa7a1247c40cfac2fe43b715e25 Author: Juri Linkov Date: Wed Nov 19 00:05:09 2014 +0200 * lisp/progmodes/grep.el (grep-compute-defaults): Compute grep-highlight-matches before its use. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba01694..7763d25 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2014-11-18 Juri Linkov + * progmodes/grep.el (grep-compute-defaults): + Compute grep-highlight-matches before its use. + +2014-11-18 Juri Linkov + * replace.el (query-replace-from-to-separator): Turn defvar into defcustom. Wrap char-displayable-p in ignore-errors because an attempt to autoload char-displayable-p fails during pre-loading. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index fd48adc..b0d4b5a 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -556,6 +556,18 @@ This function is called from `compilation-filter-hook'." (looking-at (concat (regexp-quote hello-file) ":[0-9]+:English"))))))))) + + (when (eq grep-highlight-matches 'auto-detect) + (setq grep-highlight-matches + (with-temp-buffer + (and (grep-probe grep-program '(nil t nil "--help")) + (progn + (goto-char (point-min)) + (search-forward "--color" nil t)) + ;; Windows and DOS pipes fail `isatty' detection in Grep. + (if (memq system-type '(windows-nt ms-dos)) + 'always 'auto))))) + (unless (and grep-command grep-find-command grep-template grep-find-template) (let ((grep-options @@ -632,16 +644,6 @@ This function is called from `compilation-filter-hook'." (t (format "%s . -type f -print | \"%s\" %s" find-program xargs-program gcmd)))))))) - (when (eq grep-highlight-matches 'auto-detect) - (setq grep-highlight-matches - (with-temp-buffer - (and (grep-probe grep-program '(nil t nil "--help")) - (progn - (goto-char (point-min)) - (search-forward "--color" nil t)) - ;; Windows and DOS pipes fail `isatty' detection in Grep. - (if (memq system-type '(windows-nt ms-dos)) - 'always 'auto))))) ;; Save defaults for this host. (setq grep-host-defaults-alist commit c0b877ba35f5b1d4fc63e8472d6021fba0c8395a Author: Juri Linkov Date: Tue Nov 18 23:59:14 2014 +0200 * lisp/replace.el (query-replace-from-to-separator): Turn defvar into defcustom. Wrap char-displayable-p in ignore-errors because an attempt to autoload char-displayable-p fails during pre-loading. Move (propertize "\0" ... 'separator t) out of customizable part to query-replace-read-from. (query-replace-read-from): Call custom-reevaluate-setting on query-replace-from-to-separator to reevaluate the separator depending on the return value of char-displayable-p. http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00466.html diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6a6ff73..ba01694 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,17 @@ 2014-11-18 Juri Linkov + * replace.el (query-replace-from-to-separator): Turn defvar into + defcustom. Wrap char-displayable-p in ignore-errors because an + attempt to autoload char-displayable-p fails during pre-loading. + Move (propertize "\0" ... 'separator t) out of customizable part + to query-replace-read-from. + (query-replace-read-from): Call custom-reevaluate-setting on + query-replace-from-to-separator to reevaluate the separator + depending on the return value of char-displayable-p. + http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00466.html + +2014-11-18 Juri Linkov + * bindings.el (minibuffer-local-map): Rebind [down] from next-history-element to next-line-or-history-element, and [up] from previous-history-element to previous-line-or-history-element. diff --git a/lisp/replace.el b/lisp/replace.el index c7fbcb5..2c7ad19 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -67,11 +67,16 @@ 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") -(defvar query-replace-from-to-separator - (propertize "\0" - 'display (propertize " \u2192 " 'face 'minibuffer-prompt) - 'separator t) - "String that separates FROM and TO in the history of replacement pairs.") +(defcustom query-replace-from-to-separator + (propertize + (or (ignore-errors + (if (char-displayable-p ?\u2192) " \u2192 " " -> ")) + " -> ") + 'face 'minibuffer-prompt) + "String that separates FROM and TO in the history of replacement pairs." + :group 'matching + :type 'sexp + :version "25.1") (defcustom query-replace-from-history-variable 'query-replace-history "History list to use for the FROM argument of `query-replace' commands. @@ -137,19 +142,25 @@ 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)) + (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 + 'separator t))) (query-replace-from-to-history (append - (when query-replace-from-to-separator + (when separator (mapcar (lambda (from-to) (concat (query-replace-descr (car from-to)) - query-replace-from-to-separator + separator (query-replace-descr (cdr from-to)))) query-replace-defaults)) (symbol-value query-replace-from-history-variable))) (minibuffer-allow-text-properties t) ; separator uses text-properties (prompt - (if (and query-replace-defaults query-replace-from-to-separator) + (if (and query-replace-defaults separator) (format "%s (default %s): " prompt (car query-replace-from-to-history)) (format "%s: " prompt))) (from @@ -166,7 +177,7 @@ wants to replace FROM with TO." (cons (caar query-replace-defaults) (query-replace-compile-replacement (cdar query-replace-defaults) regexp-flag)) - (let* ((to (if (and (string-match query-replace-from-to-separator from) + (let* ((to (if (and (string-match separator from) (get-text-property (match-beginning 0) 'separator from)) (query-replace-compile-replacement (substring-no-properties from (match-end 0)) regexp-flag))) commit 5c0fbcfc8aa6ee13fbd4ea1516f25c804bebcf8c Author: Juri Linkov Date: Tue Nov 18 23:33:42 2014 +0200 Use and keys to move point in the multi-line minibuffer. * lisp/bindings.el (minibuffer-local-map): Rebind [down] from next-history-element to next-line-or-history-element, and [up] from previous-history-element to previous-line-or-history-element. * lisp/simple.el (next-line-or-history-element) (previous-line-or-history-element): New commands. http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00822.html diff --git a/etc/NEWS b/etc/NEWS index 86e21c4..41b9324 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -133,6 +133,14 @@ Unicode standards. * Changes in Specialized Modes and Packages in Emacs 25.1 +** Minibuffer + +*** You can use and keys to move point in the multi-line +minibuffer just as in an ordinary buffer. Only when point moves over +the bottom/top of the minibuffer it goes to the next/previous history +element. The new commands bound to and in the minibuffer: +`next-line-or-history-element' and `previous-line-or-history-element'. + ** Search and Replace *** Query-replace history is enhanced. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index adf8273..6a6ff73 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-11-18 Juri Linkov + + * bindings.el (minibuffer-local-map): Rebind [down] from + next-history-element to next-line-or-history-element, and [up] + from previous-history-element to previous-line-or-history-element. + + * simple.el (next-line-or-history-element) + (previous-line-or-history-element): New commands. + http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00822.html + 2014-11-18 Leo Liu * emacs-lisp/nadvice.el (define-advice): New macro. diff --git a/lisp/bindings.el b/lisp/bindings.el index 1107740..789fdf0 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -839,11 +839,11 @@ if `inhibit-field-text-motion' is non-nil." (let ((map minibuffer-local-map)) (define-key map "\en" 'next-history-element) (define-key map [next] 'next-history-element) - (define-key map [down] 'next-history-element) + (define-key map [down] 'next-line-or-history-element) (define-key map [XF86Forward] 'next-history-element) (define-key map "\ep" 'previous-history-element) (define-key map [prior] 'previous-history-element) - (define-key map [up] 'previous-history-element) + (define-key map [up] 'previous-line-or-history-element) (define-key map [XF86Back] 'previous-history-element) (define-key map "\es" 'next-matching-history-element) (define-key map "\er" 'previous-matching-history-element) diff --git a/lisp/simple.el b/lisp/simple.el index 031970e..fda7040 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1984,6 +1984,36 @@ With argument N, it uses the Nth previous element." (or (zerop n) (goto-history-element (+ minibuffer-history-position n)))) +(defun next-line-or-history-element (&optional arg) + "Move cursor vertically down ARG lines, or to the next history element. +When point moves over the bottom line of multi-line minibuffer, puts ARGth +next element of the minibuffer history in the minibuffer." + (interactive "^p") + (or arg (setq arg 1)) + (let ((old-point (point))) + (condition-case nil + (next-line arg) + (end-of-buffer + ;; Restore old position since `line-move-visual' moves point to + ;; the end of the line when it fails to go to the next line. + (goto-char old-point) + (next-history-element arg))))) + +(defun previous-line-or-history-element (&optional arg) + "Move cursor vertically up ARG lines, or to the previous history element. +When point moves over the top line of multi-line minibuffer, puts ARGth +previous element of the minibuffer history in the minibuffer." + (interactive "^p") + (or arg (setq arg 1)) + (let ((old-point (point))) + (condition-case nil + (previous-line arg) + (beginning-of-buffer + ;; Restore old position since `line-move-visual' moves point to + ;; the beginning of the line when it fails to go to the previous line. + (goto-char old-point) + (previous-history-element arg))))) + (defun next-complete-history-element (n) "Get next history element which completes the minibuffer before the point. The contents of the minibuffer after the point are deleted, and replaced commit cb4f666ade76181223c197fe38fc600ea4d7ab01 Author: Rüdiger Sonderfeld Date: Tue Nov 18 18:01:55 2014 +0100 lisp/ChangeLog: Fix bug#11386. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0b1456a..adf8273 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2731,7 +2731,8 @@ (c-typeless-decl-kwds): Append "auto" onto the C++ value. (c-not-decl-init-keywords): Also exclude c-typeof-kwds from value. - Make ">>" act as double template ender in C++ Mode. + Make ">>" act as double template ender in C++ Mode. Fix + bug#11386. * progmodes/cc-langs.el (c->-op-cont-tokens): New lang-const split off from c->-op-cont-re. (c->-op-cont-tokens): Change to use the above. commit b2c4e6c82541a3d7e6544a33073039da38e13d0d Author: Rüdiger Sonderfeld Date: Tue Nov 18 17:55:21 2014 +0100 lisp/ChangeLog: add bug#13871. There was a similar patch in bug#13871. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a1635bc..0b1456a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -44,6 +44,7 @@ 2014-11-18 Paul Pogonyshev Rüdiger Sonderfeld + Fix bug#13871 (an alternative version of the patch). * progmodes/cc-langs.el: Support some of the new keywords in C++11. (c-operators): Add "alignof". commit 1148d375898652ce5dec986d11bec46bb8ac0e6d Author: Leo Liu Date: Tue Nov 18 23:57:01 2014 +0800 New macro define-advice * doc/lispref/functions.texi (Advising Named Functions): Document define-advice. * lisp/emacs-lisp/nadvice.el (define-advice): New macro. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add define-advice. (lisp-font-lock-keywords-1): Add define-advice. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0a8a0a8..6706f93 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2014-11-18 Leo Liu + + * functions.texi (Advising Named Functions): Document + define-advice. + 2014-11-17 Paul Eggert Improve time stamp handling, and be more consistent about it. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 023175e..50849d4 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1360,6 +1360,13 @@ called directly from C, and such calls ignore advice; hence, one ends up in a confusing situation where some calls (occurring from Lisp code) obey the advice and other calls (from C code) do not. +@defmac define-advice symbol (where lambda-list &optional name depth) &rest body +This macro defines an advice and adds it to the function named +@var{symbol}. The advice is an anonymous function if @var{name} is +nil or a function named @code{symbol@@name}. See @code{advice-add} +for explanation of other arguments. +@end defmac + @defun advice-add symbol where function &optional props Add the advice @var{function} to the named function @var{symbol}. @var{where} and @var{props} have the same meaning as for @code{add-function} diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e885c92..a1635bc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-18 Leo Liu + + * emacs-lisp/nadvice.el (define-advice): New macro. + * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add + define-advice. + (lisp-font-lock-keywords-1): Add define-advice. + 2014-11-18 Daiki Ueno * epg.el (epg-context): New slot EDIT-CALLBACK. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a13baf0..d84113b 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -96,7 +96,7 @@ '("defun" "defmacro" ;; Elisp. "defun*" "defsubst" - "defadvice" "define-skeleton" + "define-advice" "defadvice" "define-skeleton" "define-compilation-mode" "define-minor-mode" "define-global-minor-mode" "define-globalized-minor-mode" @@ -195,7 +195,7 @@ "ignore-errors" "dotimes" "dolist" "declare")) (lisp-errs '("warn" "error" "signal")) ;; Elisp constructs. FIXME: update dynamically from obarray. - (el-fdefs '("defadvice" "defalias" + (el-fdefs '("define-advice" "defadvice" "defalias" "define-derived-mode" "define-minor-mode" "define-generic-mode" "define-global-minor-mode" "define-globalized-minor-mode" "define-skeleton" diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index bfd939d..a81d3e4 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -441,6 +441,30 @@ of the piece of advice." (fset symbol (car (get symbol 'advice--saved-rewrite))))))) nil) +;;;###autoload +(defmacro define-advice (symbol args &rest body) + "Define an advice and add it to function named SYMBOL. +See `advice-add' and `add-function' for explanation on the +arguments. Note if NAME is nil the advice is anonymous; +otherwise it is named `SYMBOL@NAME'. + +\(fn SYMBOL (WHERE LAMBDA-LIST &optional NAME DEPTH) &rest BODY)" + (declare (indent 2) (doc-string 3) (debug (sexp sexp body))) + (or (listp args) (signal 'wrong-type-argument (list 'listp args))) + (or (<= 2 (length args) 4) + (signal 'wrong-number-of-arguments (list 2 4 (length args)))) + (let* ((where (nth 0 args)) + (lambda-list (nth 1 args)) + (name (nth 2 args)) + (depth (nth 3 args)) + (props (and depth `((depth . ,depth)))) + (advice (cond ((null name) `(lambda ,lambda-list ,@body)) + ((or (stringp name) (symbolp name)) + (intern (format "%s@%s" symbol name))) + (t (error "Unrecognized name spec `%S'" name))))) + `(prog1 ,@(and (symbolp advice) `((defun ,advice ,lambda-list ,@body))) + (advice-add ',symbol ,where #',advice ,@(and props `(',props)))))) + (defun advice-mapc (fun symbol) "Apply FUN to every advice function in SYMBOL. FUN is called with a two arguments: the function that was added, and the