1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

(tumme-backward-image): Add prefix argument. Add error

when at first image.
(tumme-forward-image): Add prefix argument. Add error when at last
image.
This commit is contained in:
Mathias Dahl 2006-07-26 09:55:10 +00:00
parent 1d3a996a58
commit 1cf87ac661

View File

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