Mercurial > emacs
comparison lisp/tumme.el @ 70888:b84970723553
Added new parameter to `tumme-display-thumbs' to be used from `tumme-next-line-and-display' and similar commands.
author | Mathias Dahl <mathias.dahl@gmail.com> |
---|---|
date | Wed, 24 May 2006 16:58:21 +0000 |
parents | ce0e66acbc05 |
children | 6bb61012beed |
comparison
equal
deleted
inserted
replaced
70887:9de7d5cf6d99 | 70888:b84970723553 |
---|---|
545 before warning the user." | 545 before warning the user." |
546 :type 'integer | 546 :type 'integer |
547 :group 'tumme) | 547 :group 'tumme) |
548 | 548 |
549 (defun tumme-dir () | 549 (defun tumme-dir () |
550 "Return the current thumbnails directory (from `tumme-dir'). | 550 "Return the current thumbnails directory (from variable `tumme-dir'). |
551 Create the thumbnails directory if it does not exist." | 551 Create the thumbnails directory if it does not exist." |
552 (let ((tumme-dir (file-name-as-directory | 552 (let ((tumme-dir (file-name-as-directory |
553 (expand-file-name tumme-dir)))) | 553 (expand-file-name tumme-dir)))) |
554 (unless (file-directory-p tumme-dir) | 554 (unless (file-directory-p tumme-dir) |
555 (make-directory tumme-dir t) | 555 (make-directory tumme-dir t) |
699 (defun tumme-next-line-and-display () | 699 (defun tumme-next-line-and-display () |
700 "Move to next dired line and display thumbnail image." | 700 "Move to next dired line and display thumbnail image." |
701 (interactive) | 701 (interactive) |
702 (dired-next-line 1) | 702 (dired-next-line 1) |
703 (tumme-display-thumbs | 703 (tumme-display-thumbs |
704 t (or tumme-append-when-browsing nil)) | 704 t (or tumme-append-when-browsing nil) t) |
705 (if tumme-dired-disp-props | 705 (if tumme-dired-disp-props |
706 (tumme-dired-display-properties))) | 706 (tumme-dired-display-properties))) |
707 | 707 |
708 (defun tumme-previous-line-and-display () | 708 (defun tumme-previous-line-and-display () |
709 "Move to previous dired line and display thumbnail image." | 709 "Move to previous dired line and display thumbnail image." |
710 (interactive) | 710 (interactive) |
711 (dired-previous-line 1) | 711 (dired-previous-line 1) |
712 (tumme-display-thumbs | 712 (tumme-display-thumbs |
713 t (or tumme-append-when-browsing nil)) | 713 t (or tumme-append-when-browsing nil) t) |
714 (if tumme-dired-disp-props | 714 (if tumme-dired-disp-props |
715 (tumme-dired-display-properties))) | 715 (tumme-dired-display-properties))) |
716 | 716 |
717 (defun tumme-toggle-append-browsing () | 717 (defun tumme-toggle-append-browsing () |
718 "Toggle `tumme-append-when-browsing'." | 718 "Toggle `tumme-append-when-browsing'." |
727 (defun tumme-mark-and-display-next () | 727 (defun tumme-mark-and-display-next () |
728 "Mark current file in dired and display next thumbnail image." | 728 "Mark current file in dired and display next thumbnail image." |
729 (interactive) | 729 (interactive) |
730 (dired-mark 1) | 730 (dired-mark 1) |
731 (tumme-display-thumbs | 731 (tumme-display-thumbs |
732 t (or tumme-append-when-browsing nil)) | 732 t (or tumme-append-when-browsing nil) t) |
733 (if tumme-dired-disp-props | 733 (if tumme-dired-disp-props |
734 (tumme-dired-display-properties))) | 734 (tumme-dired-display-properties))) |
735 | 735 |
736 (defun tumme-toggle-dired-display-properties () | 736 (defun tumme-toggle-dired-display-properties () |
737 "Toggle `tumme-dired-disp-props'." | 737 "Toggle `tumme-dired-disp-props'." |
816 (if tumme-saved-window-configuration | 816 (if tumme-saved-window-configuration |
817 (set-window-configuration tumme-saved-window-configuration) | 817 (set-window-configuration tumme-saved-window-configuration) |
818 (message "No saved window configuration"))) | 818 (message "No saved window configuration"))) |
819 | 819 |
820 ;;;###autoload | 820 ;;;###autoload |
821 (defun tumme-display-thumbs (&optional arg append) | 821 (defun tumme-display-thumbs (&optional arg append do-not-pop) |
822 "Display thumbnails of all marked files, in `tumme-thumbnail-buffer'. | 822 "Display thumbnails of all marked files, in `tumme-thumbnail-buffer'. |
823 If a thumbnail image does not exist for a file, it is created on the | 823 If a thumbnail image does not exist for a file, it is created on the |
824 fly. With prefix argument ARG, display only thumbnail for file at | 824 fly. With prefix argument ARG, display only thumbnail for file at |
825 point (this is useful if you have marked some files but want to show | 825 point (this is useful if you have marked some files but want to show |
826 another one). | 826 another one). |
828 Recommended usage is to split the current frame horizontally so that | 828 Recommended usage is to split the current frame horizontally so that |
829 you have the dired buffer in the left window and the | 829 you have the dired buffer in the left window and the |
830 `tumme-thumbnail-buffer' buffer in the right window. | 830 `tumme-thumbnail-buffer' buffer in the right window. |
831 | 831 |
832 With optional argument APPEND, append thumbnail to thumbnail buffer | 832 With optional argument APPEND, append thumbnail to thumbnail buffer |
833 instead of erasing it first." | 833 instead of erasing it first. |
834 | |
835 Option argument DO-NOT-POP controls if `pop-to-buffer' should be | |
836 used or not. If non-nil, use `display-buffer' instead of | |
837 `pop-to-buffer'. This is used from functions like | |
838 `tumme-next-line-and-display' and | |
839 `tumme-previous-line-and-display' where we do not want the | |
840 thumbnail buffer to be selected." | |
834 (interactive "P") | 841 (interactive "P") |
835 (let ((buf (tumme-create-thumbnail-buffer)) | 842 (let ((buf (tumme-create-thumbnail-buffer)) |
836 curr-file thumb-name files count dired-buf beg) | 843 curr-file thumb-name files count dired-buf beg) |
837 (if arg | 844 (if arg |
838 (setq files (list (dired-get-filename))) | 845 (setq files (list (dired-get-filename))) |
860 (tumme-line-up-interactive)) | 867 (tumme-line-up-interactive)) |
861 ((eq 'none tumme-line-up-method) | 868 ((eq 'none tumme-line-up-method) |
862 nil) | 869 nil) |
863 (t | 870 (t |
864 (tumme-line-up-dynamic)))) | 871 (tumme-line-up-dynamic)))) |
865 (pop-to-buffer tumme-thumbnail-buffer))) | 872 (if do-not-pop |
873 (display-buffer tumme-thumbnail-buffer) | |
874 (pop-to-buffer tumme-thumbnail-buffer)))) | |
866 | 875 |
867 (defun tumme-show-all-from-dir (dir) | 876 (defun tumme-show-all-from-dir (dir) |
868 "Make a preview buffer for all images in DIR and display it. | 877 "Make a preview buffer for all images in DIR and display it. |
869 If the number of files in DIR matching `image-file-name-regexp' | 878 If the number of files in DIR matching `image-file-name-regexp' |
870 exceeds `tumme-show-all-from-dir-max-files', a warning will be | 879 exceeds `tumme-show-all-from-dir-max-files', a warning will be |
1656 | 1665 |
1657 ;;;###autoload | 1666 ;;;###autoload |
1658 (defun tumme-display-thumbs-append () | 1667 (defun tumme-display-thumbs-append () |
1659 "Append thumbnails to `tumme-thumbnail-buffer'." | 1668 "Append thumbnails to `tumme-thumbnail-buffer'." |
1660 (interactive) | 1669 (interactive) |
1661 (tumme-display-thumbs nil t)) | 1670 (tumme-display-thumbs nil t t)) |
1662 | 1671 |
1663 ;;;###autoload | 1672 ;;;###autoload |
1664 (defun tumme-display-thumb () | 1673 (defun tumme-display-thumb () |
1665 "Shorthard for `tumme-display-thumbs' with prefix argument." | 1674 "Shorthard for `tumme-display-thumbs' with prefix argument." |
1666 (interactive) | 1675 (interactive) |
1667 (tumme-display-thumbs t)) | 1676 (tumme-display-thumbs t nil t)) |
1668 | 1677 |
1669 (defun tumme-line-up () | 1678 (defun tumme-line-up () |
1670 "Line up thumbnails according to `tumme-thumbs-per-row'. | 1679 "Line up thumbnails according to `tumme-thumbs-per-row'. |
1671 See also `tumme-line-up-dynamic'." | 1680 See also `tumme-line-up-dynamic'." |
1672 (interactive) | 1681 (interactive) |