diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2016-12-13 22:56:42 -0500 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2016-12-13 22:56:42 -0500 |
commit | 51b2669ad51441b3bd318c749e67b267defe4882 (patch) | |
tree | 2ee4e98f23faf7c0f8dd4863c374095242d452eb /lisp/image-dired.el | |
parent | c27b645956a11fab1dd8fa189254d525390958f5 (diff) | |
download | emacs-51b2669ad51441b3bd318c749e67b267defe4882.tar.gz |
More image-dired polish
* lisp/image-dired.el (image-dired-file-name-at-point): New function.
(image-dired-thumbnail-mode, image-dired-display-image-mode): Disable
undo list. Add image-dired-file-name-at-point to
file-name-at-point-functions to facilitate find-file and friends.
(image-dired-thumbnail-display-external):
(image-dired-dired-display-external): Use start-process instead, to
avoid needlessly blocking and using a shell.
Diffstat (limited to 'lisp/image-dired.el')
-rw-r--r-- | lisp/image-dired.el | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/image-dired.el b/lisp/image-dired.el index c5fcadc5b00..cff4ef82f3a 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1021,6 +1021,12 @@ With prefix argument ARG, remove tag from file at point." "Get original file name for thumbnail or display image at point." (get-text-property (point) 'original-file-name)) +(defun image-dired-file-name-at-point () + "Get abbreviated file name for thumbnail or display image at point." + (let ((f (image-dired-original-file-name))) + (when f + (abbreviate-file-name f)))) + (defun image-dired-associated-dired-buffer () "Get associated dired buffer at point." (get-text-property (point) 'associated-dired-buffer)) @@ -1416,13 +1422,15 @@ You probably want to use this together with fundamental-mode "image-dired-thumbnail" "Browse and manipulate thumbnail images using dired. Use `image-dired-minor-mode' to get a nice setup." - (message "image-dired-thumbnail-mode enabled")) + (buffer-disable-undo) + (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (define-derived-mode image-dired-display-image-mode fundamental-mode "image-dired-image-display" "Mode for displaying and manipulating original image. Resized or in full-size." - (message "image-dired-display-image-mode enabled")) + (buffer-disable-undo) + (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (defvar image-dired-minor-mode-map (let ((map (make-sparse-keymap))) @@ -1621,16 +1629,16 @@ Ask user how many thumbnails should be displayed per row." (message "No thumbnail at point") (if (not file) (message "No original file name found") - (call-process shell-file-name nil nil nil shell-command-switch - (format "%s \"%s\"" image-dired-external-viewer file)))))) + (start-process "image-dired-thumb-external" nil + image-dired-external-viewer file))))) ;;;###autoload (defun image-dired-dired-display-external () "Display file at point using an external viewer." (interactive) (let ((file (dired-get-filename))) - (call-process shell-file-name nil nil nil shell-command-switch - (format "%s \"%s\"" image-dired-external-viewer file)))) + (start-process "image-dired-external" nil + image-dired-external-viewer file))) (defun image-dired-window-width-pixels (window) "Calculate WINDOW width in pixels." |