diff options
Diffstat (limited to 'lisp/dired.el')
| -rw-r--r-- | lisp/dired.el | 79 |
1 files changed, 44 insertions, 35 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 6684be3356c..cd27b6b6404 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1331,16 +1331,16 @@ DIRED-FILENAME WINDOW-POINT)." "Mark all files remembered in ALIST. Each element of ALIST looks like (FILE . MARKERCHAR)." (let (elt fil chr) - (while alist - (setq elt (car alist) - alist (cdr alist) - fil (car elt) - chr (cdr elt)) - (if (dired-goto-file fil) - (save-excursion - (beginning-of-line) - (delete-char 1) - (insert chr)))))) + (save-excursion + (while alist + (setq elt (car alist) + alist (cdr alist) + fil (car elt) + chr (cdr elt)) + (when (dired-goto-file fil) + (beginning-of-line) + (delete-char 1) + (insert chr)))))) (defun dired-remember-hidden () "Return a list of names of subdirs currently hidden." @@ -1739,7 +1739,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map [menu-bar operate epa-dired-do-decrypt] - '(menu-item "Decrypt" epa-dired-do-decrypt + '(menu-item "Decrypt..." epa-dired-do-decrypt :help "Decrypt file at cursor")) (define-key map @@ -1749,12 +1749,12 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map [menu-bar operate epa-dired-do-sign] - '(menu-item "Sign" epa-dired-do-sign + '(menu-item "Sign..." epa-dired-do-sign :help "Create digital signature of file at cursor")) (define-key map [menu-bar operate epa-dired-do-encrypt] - '(menu-item "Encrypt" epa-dired-do-encrypt + '(menu-item "Encrypt..." epa-dired-do-encrypt :help "Encrypt file at cursor")) (define-key map [menu-bar operate dashes-3] @@ -2950,6 +2950,8 @@ or \"* [3 files]\"." (split-window-sensibly window)))) pop-up-frames) (pop-to-buffer (get-buffer-create buf))) + ;; See Bug#12281. + (set-window-start nil (point-min)) ;; If dired-shrink-to-fit is t, make its window fit its contents. (when dired-shrink-to-fit ;; Try to not delete window when we want to display less than @@ -2971,36 +2973,43 @@ If t, confirmation is never needed." (const shell) (const symlink) (const touch) (const uncompress)))) -(defun dired-mark-pop-up (bufname op-symbol files function &rest args) +(defun dired-mark-pop-up (buffer-or-name op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. -Displays the file names in a buffer named BUFNAME; - nil gives \" *Marked Files*\". -This uses function `dired-pop-to-buffer' to do that. - -FUNCTION should not manipulate files, just read input - (an argument or confirmation). -The window is not shown if there is just one file or - OP-SYMBOL is a member of the list in `dired-no-confirm'. +Displays the file names in a window showing a buffer named +BUFFER-OR-NAME; the default name being \" *Marked Files*\". The +window is not shown if there is just one file, `dired-no-confirm' +is t, or OP-SYMBOL is a member of the list in `dired-no-confirm'. + FILES is the list of marked files. It can also be (t FILENAME) in the case of one marked file, to distinguish that from using -just the current file." - (or bufname (setq bufname " *Marked Files*")) +just the current file. + +FUNCTION should not manipulate files, just read input \(an +argument or confirmation)." (if (or (eq dired-no-confirm t) (memq op-symbol dired-no-confirm) ;; If FILES defaulted to the current line's file. (= (length files) 1)) (apply function args) - (with-current-buffer (get-buffer-create bufname) - (erase-buffer) - ;; Handle (t FILE) just like (FILE), here. - ;; That value is used (only in some cases), to mean - ;; just one file that was marked, rather than the current line file. - (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files)) - (remove-text-properties (point-min) (point-max) - '(mouse-face nil help-echo nil))) - (save-window-excursion - (dired-pop-to-buffer bufname) - (apply function args)))) + (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))) + (with-current-buffer buffer + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected nil) + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (apply function args) + (when (window-live-p window) + (quit-restore-window window 'kill))))) + ;; Handle (t FILE) just like (FILE), here. That value is + ;; used (only in some cases), to mean just one file that was + ;; marked, rather than the current line file. + (dired-format-columns-of-files + (if (eq (car files) t) (cdr files) files)) + (remove-text-properties (point-min) (point-max) + '(mouse-face nil help-echo nil)))))))) (defun dired-format-columns-of-files (files) (let ((beg (point))) |
