From: John Paul Wallington <jpw@gnu.org>
Cc: emacs-devel@gnu.org
Subject: misc thumbs changes
Date: Mon, 03 May 2004 06:46:37 +0100 [thread overview]
Message-ID: <E1BKWHl-0005hR-00@indigo.shootybangbang.com> (raw)
How about installing the following changes?
2004-05-03 John Paul Wallington <jpw@gnu.org>
* thumbs.el (thumbs-subst-char-in-string): Doc fix.
(thumbs-insert-image): Bind `inhibit-read-only' to t when
inserting image.
(thumbs-find-image-at-point): Do nothing if there is
no image specified nor at point.
(thumbs-show-name): Do nothing if no image at point.
(thumbs-mouse-find-image): New command.
(thumbs-mode-map): Bind it to mouse-2.
(thumbs-mode): Make buffer read only. Make mode-class special.
(thumbs-view-image-mode): Likewise.
--- thumbs.el 29 Apr 2004 00:19:43 +0100 1.5
+++ thumbs.el 03 May 2004 06:45:08 +0100
@@ -309,9 +309,10 @@
(interactive)
(thumbs-resize-image t))
+;; borrowed from Dave Love
(defun thumbs-subst-char-in-string (orig rep string)
"Replace occurrences of character ORIG with character REP in STRING.
-Return the resulting (new) string. -- (defun borowed to Dave Love)"
+Return the resulting (new) string."
(let ((string (copy-sequence string))
(l (length string))
(i 0))
@@ -372,7 +373,8 @@
:relief ,relief
:conversion ,(if marked 'disabled)
:margin ,thumbs-margin)))
- (insert-image i)
+ (let ((inhibit-read-only t))
+ (insert-image i))
(setq thumbs-current-image-size
(image-size i t))))
@@ -461,7 +463,7 @@
(let* ((L thumbs-fileL)
(n (point))
(i (or img (cdr (assoc n L)))))
- (thumbs-find-image i L n otherwin)))
+ (and i (thumbs-find-image i L n otherwin))))
(defun thumbs-find-image-at-point-other-window ()
"Display image for thumbnail at point in the preview buffer.
@@ -469,6 +471,12 @@
(interactive)
(thumbs-find-image-at-point nil t))
+(defun thumbs-mouse-find-image (event)
+ "Display image for thumbnail at mouse click EVENT."
+ (interactive "e")
+ (mouse-set-point event)
+ (thumbs-find-image-at-point))
+
(defun thumbs-call-setroot-command (img)
"Call the setroot program for IMG."
(run-hooks 'thumbs-before-setroot-hook)
@@ -640,7 +648,7 @@
"Show the name of the current file."
(interactive)
(let ((f (cdr (assoc (point) thumbs-fileL))))
- (message "%s [%s]" f (thumbs-file-size f))))
+ (and f (message "%s [%s]" f (thumbs-file-size f)))))
(defun thumbs-save-current-image ()
"Save the current image."
@@ -661,6 +669,7 @@
(defvar thumbs-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [return] 'thumbs-find-image-at-point)
+ (define-key map [mouse-2] 'thumbs-mouse-find-image)
(define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
(define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
(define-key map [delete] 'thumbs-delete-images)
@@ -675,9 +684,11 @@
map)
"Keymap for `thumbs-mode'.")
+(put 'thumbs-mode 'mode-class 'special)
(define-derived-mode thumbs-mode
fundamental-mode "thumbs"
"Preview images in a thumbnails buffer"
+ (setq buffer-read-only t)
(make-variable-buffer-local 'thumbs-markedL)
(setq thumbs-markedL nil))
@@ -697,9 +708,10 @@
map)
"Keymap for `thumbs-view-image-mode'.")
-;; thumbs-view-image-mode
+(put 'thumbs-mode 'mode-class 'special)
(define-derived-mode thumbs-view-image-mode
- fundamental-mode "image-view-mode")
+ fundamental-mode "image-view-mode"
+ (setq buffer-read-only t))
;;;###autoload
(defun thumbs-dired-setroot ()
next reply other threads:[~2004-05-03 5:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-03 5:46 John Paul Wallington [this message]
2004-05-03 5:51 ` misc thumbs changes John Paul Wallington
2004-05-03 13:34 ` Stefan Monnier
2004-05-03 18:05 ` John Paul Wallington
2004-05-03 22:20 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1BKWHl-0005hR-00@indigo.shootybangbang.com \
--to=jpw@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.