unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* misc thumbs changes
@ 2004-05-03  5:46 John Paul Wallington
  2004-05-03  5:51 ` John Paul Wallington
  2004-05-03 13:34 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: John Paul Wallington @ 2004-05-03  5:46 UTC (permalink / raw)
  Cc: emacs-devel

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 ()

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: misc thumbs changes
  2004-05-03  5:46 misc thumbs changes John Paul Wallington
@ 2004-05-03  5:51 ` John Paul Wallington
  2004-05-03 13:34 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: John Paul Wallington @ 2004-05-03  5:51 UTC (permalink / raw)
  Cc: emacs-devel

> +(put 'thumbs-mode 'mode-class 'special)
>  (define-derived-mode thumbs-view-image-mode

Doh!
Should say (put 'thumbs-view-image-mode 'mode-class 'special).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: misc thumbs changes
  2004-05-03  5:46 misc thumbs changes John Paul Wallington
  2004-05-03  5:51 ` 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
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2004-05-03 13:34 UTC (permalink / raw)
  Cc: emacs-devel, jphiltheberge

>  (defun thumbs-subst-char-in-string (orig rep string)

BTW, what's wrong with subst-char-in-string?


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: misc thumbs changes
  2004-05-03 13:34 ` Stefan Monnier
@ 2004-05-03 18:05   ` John Paul Wallington
  2004-05-03 22:20   ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: John Paul Wallington @ 2004-05-03 18:05 UTC (permalink / raw)
  Cc: jphiltheberge, emacs-devel

> >  (defun thumbs-subst-char-in-string (orig rep string)
> 
> BTW, what's wrong with subst-char-in-string?

Nothing.  We should use it instead.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: misc thumbs changes
  2004-05-03 13:34 ` Stefan Monnier
  2004-05-03 18:05   ` John Paul Wallington
@ 2004-05-03 22:20   ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2004-05-03 22:20 UTC (permalink / raw)
  Cc: jphiltheberge, jpw, emacs-devel

I did a lot of work on thumbs.el after I started using it myself.
But there were some bugs I could not figure out, so I did not install
the changes.

The right thing is for me to install my changes.  I will do that in
the next few days some time.

In the mean time, please don't install any other changes in thumbs.el.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-05-03 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03  5:46 misc thumbs changes John Paul Wallington
2004-05-03  5:51 ` 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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).