commit 0e355e781616936759cff8e6a46adb01760d4211 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Tue Feb 28 11:47:45 2017 +0900 Show Ibuffer and jump to line listing current buffer * lisp/ibuffer.el (ibuffer-jump): New command (Bug#25577). ; * etc/NEWS: Add entry for it. diff --git a/etc/NEWS b/etc/NEWS index 31b7e4789e..5b5baff44e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -394,6 +394,9 @@ added: 'C-c C-s C-m C-m'. ** Ibuffer --- +*** New command 'ibuffer-jump'. + +--- *** New filter commands 'ibuffer-filter-by-basename', 'ibuffer-filter-by-file-extension', 'ibuffer-filter-by-directory', 'ibuffer-filter-by-starred-name', 'ibuffer-filter-by-modified' diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index eb821b257b..66916b2bca 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2491,6 +2491,15 @@ FORMATS is the value to use for `ibuffer-formats'. (unless ibuffer-expert (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help")))))) +;;;###autoload +(defun ibuffer-jump (&optional other-window) + "Call Ibuffer and set point at the line listing the current buffer. +If optional arg OTHER-WINDOW is non-nil, then use another window." + (interactive "P") + (let ((name (buffer-name))) + (ibuffer other-window) + (ignore-errors (ibuffer-jump-to-buffer name)))) + (put 'ibuffer-mode 'mode-class 'special) (define-derived-mode ibuffer-mode special-mode "IBuffer" "A major mode for viewing a list of buffers. commit 499b43d4cc4aa8fd1131246aa544ab81e894e8da Author: Juri Linkov Date: Tue Feb 28 00:53:46 2017 +0200 * lisp/vc/add-log.el (change-log-next-buffer): Check if file exists before adding it to the list of files. diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index 52be9c5a2b..ceef5724dc 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -1077,14 +1077,16 @@ A sequence of buffers is formed by ChangeLog files with decreasing numeric file name suffixes in the directory of the initial ChangeLog file were isearch was started." (let* ((name (change-log-name)) - (files (cons name (sort (file-expand-wildcards - (concat name "[-.][0-9]*")) - (lambda (a b) - ;; The file's extension may not have a valid - ;; version form (e.g. VC backup revisions). - (ignore-errors - (version< (substring b (length name)) - (substring a (length name)))))))) + (files (append + (and (file-exists-p name) (list name)) + (sort (file-expand-wildcards + (concat name "[-.][0-9]*")) + (lambda (a b) + ;; The file's extension may not have a valid + ;; version form (e.g. VC backup revisions). + (ignore-errors + (version< (substring b (length name)) + (substring a (length name)))))))) (files (if isearch-forward files (reverse files))) (file (if wrap (car files) commit 61881d32ad4a8407fd4a3386a5f05b9f446f58fc Author: Juri Linkov Date: Tue Feb 28 00:50:57 2017 +0200 Put text properties on query-replace separator string instead of "\0" * lisp/replace.el (query-replace--split-string): Split at a substring instead of just character. (query-replace-read-from): Put text properties on the separator string instead of "\0". (Bug#25482) diff --git a/lisp/replace.el b/lisp/replace.el index b96c883982..0841ba11b8 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -149,14 +149,17 @@ See `replace-regexp' and `query-replace-regexp-eval'.") (mapconcat 'isearch-text-char-description string "")) (defun query-replace--split-string (string) - "Split string STRING at a character with property `separator'" + "Split string STRING at a substring with property `separator'." (let* ((length (length string)) (split-pos (text-property-any 0 length 'separator t string))) (if (not split-pos) (substring-no-properties string) - (cl-assert (not (text-property-any (1+ split-pos) length 'separator t string))) (cons (substring-no-properties string 0 split-pos) - (substring-no-properties string (1+ split-pos) length))))) + (substring-no-properties + string (or (text-property-not-all + (1+ split-pos) length 'separator t string) + length) + length))))) (defun query-replace-read-from (prompt regexp-flag) "Query and return the `from' argument of a query-replace operation. @@ -165,17 +168,19 @@ wants to replace FROM with TO." (if query-replace-interactive (car (if regexp-flag regexp-search-ring search-ring)) (let* ((history-add-new-input nil) - (separator + (separator-string (when query-replace-from-to-separator - (propertize "\0" - 'display - (propertize - (if (char-displayable-p - (string-to-char (replace-regexp-in-string - " " "" query-replace-from-to-separator))) - query-replace-from-to-separator - " -> ") - 'face 'minibuffer-prompt) + ;; Check if the first non-whitespace char is displayable + (if (char-displayable-p + (string-to-char (replace-regexp-in-string + " " "" query-replace-from-to-separator))) + query-replace-from-to-separator + " -> "))) + (separator + (when separator-string + (propertize separator-string + 'display separator-string + 'face 'minibuffer-prompt 'separator t))) (minibuffer-history (append @@ -203,7 +208,8 @@ wants to replace FROM with TO." (minibuffer-with-setup-hook (lambda () (setq-local text-property-default-nonsticky - (cons '(separator . t) text-property-default-nonsticky))) + (append '((separator . t) (face . t)) + text-property-default-nonsticky))) (if regexp-flag (read-regexp prompt nil 'minibuffer-history) (read-from-minibuffer commit 3bf717b05b9d8fb53e953aa56649ffc38fd6e5d1 Author: Juri Linkov Date: Tue Feb 28 00:45:21 2017 +0200 Add file name and its extension to suggestions in dired-mark-files-regexp * lisp/dired.el (dired-mark-files-regexp): Add file name and its extension to the list of suggested defaults. (Bug#25578) diff --git a/lisp/dired.el b/lisp/dired.el index 2733372eb7..8396652d50 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3361,7 +3361,14 @@ object files--just `.o' will mark more than you might think." (interactive (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark") " files (regexp): ") - nil 'dired-regexp-history) + ;; Add more suggestions into the default list + (cons nil (list (dired-get-filename t t) + (and (dired-get-filename nil t) + (concat (regexp-quote + (file-name-extension + (dired-get-filename nil t) t)) + "\\'")))) + 'dired-regexp-history) (if current-prefix-arg ?\040))) (let ((dired-marker-char (or marker-char dired-marker-char))) (dired-mark-if commit 50a2ccd87ec6d1b275f3906cec4ccc28be05c589 Author: Chunyang Xu Date: Tue Feb 28 00:41:56 2017 +0200 Prompt default extension in dired-mark-extension * lisp/dired-x.el (dired-mark-extension): Prompt default extension based on extension of file at point. (Bug#25578) Copyright-paperwork-exempt: yes diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 86c95372c2..6c8fb0e7da 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -342,22 +342,29 @@ Interactively, ask for EXTENSION. Prefixed with one C-u, unmark files instead. Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." (interactive - (let ((suffix - (read-string (format "%s extension: " - (if (equal current-prefix-arg '(4)) - "UNmarking" - "Marking")))) - (marker - (pcase current-prefix-arg - ('(4) ?\s) - ('(16) - (let* ((dflt (char-to-string dired-marker-char)) - (input (read-string - (format - "Marker character to use (default %s): " dflt) - nil nil dflt))) - (aref input 0))) - (_ dired-marker-char)))) + (let* ((default + (let ((file (dired-get-filename nil t))) + (when file + (file-name-extension file)))) + (suffix + (read-string (format "%s extension%s: " + (if (equal current-prefix-arg '(4)) + "UNmarking" + "Marking") + (if default + (format " (default %s)" default) + "")) nil nil default)) + (marker + (pcase current-prefix-arg + ('(4) ?\s) + ('(16) + (let* ((dflt (char-to-string dired-marker-char)) + (input (read-string + (format + "Marker character to use (default %s): " dflt) + nil nil dflt))) + (aref input 0))) + (_ dired-marker-char)))) (list suffix marker))) (or (listp extension) (setq extension (list extension)))