GNU bug report logs - #8453
enhancement to image mode

Previous Next

Package: emacs;

Reported by: Christian Wittern <cwittern <at> gmail.com>

Date: Sat, 9 Apr 2011 01:31:02 UTC

Severity: wishlist

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8453 in the body.
You can then email your comments to 8453 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8453; Package emacs. (Sat, 09 Apr 2011 01:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christian Wittern <cwittern <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Apr 2011 01:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christian Wittern <cwittern <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: enhancement to image mode
Date: Sat, 09 Apr 2011 10:29:48 +0900
Hello, I am trying to send this through the send bug report function, I hope
it works.

With the help of Drew Adams on gnu.emacs.help, I added the following to
image-mode, which allows one to visit the following or previous image, which
is useful if images are in a series, such as in pages of books.  If this is
deemed useful, I would like to have this added to emacs.

(require 'image-mode)
(define-key image-mode-map "n" 'next-image)
(define-key image-mode-map "p" 'previous-image)

(defun next-image (arg)
  "when visitng an image, go to the next image in the same
directory of the same type. No argument or nil will move to the
following image in ascending order, t will move to the previous
one.  Thanks to Drew Adams for help with this on gnu.emacs.help"
  (interactive "P")
  (unless (and (buffer-file-name) (eq major-mode 'image-mode))
    (error "Not visiting a file in image mode"))
  (let* ((files   (directory-files
		   (file-name-directory (buffer-file-name)) nil
		   (file-name-extension (buffer-file-name)) ))
         (len     (length files))
         (this    (file-name-nondirectory (buffer-file-name)))
         (idx     0))
    (catch 'next-image
      (dolist (file  files)
        (when (string= this file) (throw 'next-image (1+ idx)))
        (setq idx  (1+ idx))))
    (setq idx  (+ idx (if arg -1 1)))
    (when (< idx 0) (setq idx (1- len)))
    (when (>= idx len) (setq idx 0))
    (find-file (elt files idx))))

(defun previous-image (arg)
  "when visitng an image, go to the next image in the same
directory of the same type. No argument or nil will move to the
following image in ascending order, t will move to the previous
one.  Thanks to Drew Adams for help with this on gnu.emacs.help"
  (interactive "P")
  (next-image t))


-- 
 Christian Wittern




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8453; Package emacs. (Sun, 10 Apr 2011 03:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 8453 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Christian Wittern <cwittern <at> gmail.com>
Cc: 8453 <at> debbugs.gnu.org
Subject: Re: bug#8453: enhancement to image mode
Date: Sun, 10 Apr 2011 00:27:56 -0300
> With the help of Drew Adams on gnu.emacs.help, I added the following to
> image-mode, which allows one to visit the following or previous image, which
> is useful if images are in a series, such as in pages of books.  If this is
> deemed useful, I would like to have this added to emacs.

This looks very handy, indeed.  I'd recommend to slightly change the
code so it just looks for the first filename greater than the current
name (so it also works in the odd case where the current file is not in
the directory any more).

I'm currently traveling, so if someone else can take care of
cleaning-up and installing this code, I'd appreciate it.


        Stefan


PS: this again calls for closer integration between doc-mode and image-mode.




Reply sent to Chong Yidong <cyd <at> gnu.org>:
You have taken responsibility. (Sat, 19 Jan 2013 15:25:01 GMT) Full text and rfc822 format available.

Notification sent to Christian Wittern <cwittern <at> gmail.com>:
bug acknowledged by developer. (Sat, 19 Jan 2013 15:25:01 GMT) Full text and rfc822 format available.

Message #13 received at 8453-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Christian Wittern <cwittern <at> gmail.com>, 8453-done <at> debbugs.gnu.org
Subject: Re: bug#8453: enhancement to image mode
Date: Sat, 19 Jan 2013 23:23:19 +0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> With the help of Drew Adams on gnu.emacs.help, I added the following
>> to image-mode, which allows one to visit the following or previous
>> image, which is useful if images are in a series, such as in pages of
>> books.  If this is deemed useful, I would like to have this added to
>> emacs.
>
> This looks very handy, indeed.  I'd recommend to slightly change the
> code so it just looks for the first filename greater than the current
> name (so it also works in the odd case where the current file is not
> in the directory any more).

Done, with some substantial modifications.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 91 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.