From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: John Paul Wallington Newsgroups: gmane.emacs.devel Subject: misc thumbs changes Date: Mon, 03 May 2004 06:46:37 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1083563511 20032 80.91.224.253 (3 May 2004 05:51:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 3 May 2004 05:51:51 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 03 07:51:43 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BKWMh-0006FN-00 for ; Mon, 03 May 2004 07:51:43 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BKWMg-00008H-00 for ; Mon, 03 May 2004 07:51:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BKWKU-0006ew-8Y for emacs-devel@quimby.gnus.org; Mon, 03 May 2004 01:49:26 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BKWKO-0006bU-M5 for emacs-devel@gnu.org; Mon, 03 May 2004 01:49:20 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BKWJs-0006Bp-PT for emacs-devel@gnu.org; Mon, 03 May 2004 01:49:19 -0400 Original-Received: from [217.44.221.99] (helo=indigo.shootybangbang.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BKWJs-0006Bg-1j for emacs-devel@gnu.org; Mon, 03 May 2004 01:48:48 -0400 Original-Received: from jpw by indigo.shootybangbang.com with local (Exim 3.36 #1 (Debian)) id 1BKWHl-0005hR-00; Mon, 03 May 2004 06:46:37 +0100 Original-To: jphiltheberge@videotron.ca X-Mailer: Norman X-Attribution: jpw X-Face: R(_z-rF:grdKO.*u`n); p.i$Eiz=h^CO5eDYv"4:K@#\HN09*Ykx}}B{kF/KH}%f_o^Wp List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22578 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22578 How about installing the following changes? 2004-05-03 John Paul Wallington * 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 ()