diff options
author | Mathias Dahl <mathias.dahl@gmail.com> | 2006-07-26 09:55:10 +0000 |
---|---|---|
committer | Mathias Dahl <mathias.dahl@gmail.com> | 2006-07-26 09:55:10 +0000 |
commit | ec485c26cef3baa37e5d5d08e0382b2f7d03bd64 (patch) | |
tree | bfd604978feb491af5de280f9567de1ad83451aa /lisp | |
parent | 22179358c61451e978becb7b5112e951a2ca2058 (diff) | |
download | emacs-ec485c26cef3baa37e5d5d08e0382b2f7d03bd64.tar.gz |
(tumme-backward-image): Add prefix argument. Add error
when at first image.
(tumme-forward-image): Add prefix argument. Add error when at last
image.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/tumme.el | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/lisp/tumme.el b/lisp/tumme.el index 9e76c6c3b59..3bd1d41886e 100644 --- a/lisp/tumme.el +++ b/lisp/tumme.el @@ -1072,32 +1072,46 @@ move ARG lines." (if tumme-track-movement (tumme-track-thumbnail))) -(defun tumme-forward-image () - "Move to next image and display properties." - (interactive) - ;; Before we move, make sure that there is an image two positions - ;; forward. - (when (save-excursion - (forward-char 2) - (tumme-image-at-point-p)) - (forward-char) - (while (and (not (eobp)) - (not (tumme-image-at-point-p))) - (forward-char)) - (if tumme-track-movement - (tumme-track-original-file))) +(defun tumme-forward-image (&optional arg) + "Move to next image and display properties. +Optional prefix ARG says how many images to move; default is one +image." + (interactive "p") + (let (pos (steps (or arg 1))) + (dotimes (i steps) + (if (and (not (eobp)) + (save-excursion + (forward-char) + (while (and (not (eobp)) + (not (tumme-image-at-point-p))) + (forward-char)) + (setq pos (point)) + (tumme-image-at-point-p))) + (goto-char pos) + (error "At last image")))) + (when tumme-track-movement + (tumme-track-original-file)) (tumme-display-thumb-properties)) -(defun tumme-backward-image () - "Move to previous image and display properties." - (interactive) - (when (not (bobp)) - (backward-char) - (while (and (not (bobp)) - (not (tumme-image-at-point-p))) - (backward-char)) - (if tumme-track-movement - (tumme-track-original-file))) +(defun tumme-backward-image (&optional arg) + "Move to previous image and display properties. +Optional prefix ARG says how many images to move; default is one +image." + (interactive "p") + (let (pos (steps (or arg 1))) + (dotimes (i steps) + (if (and (not (bobp)) + (save-excursion + (backward-char) + (while (and (not (bobp)) + (not (tumme-image-at-point-p))) + (backward-char)) + (setq pos (point)) + (tumme-image-at-point-p))) + (goto-char pos) + (error "At first image")))) + (when tumme-track-movement + (tumme-track-original-file)) (tumme-display-thumb-properties)) (defun tumme-next-line () |