unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* looping cursor position in dired
@ 2005-11-17 20:47 Sebastian Luque
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Luque @ 2005-11-17 20:47 UTC (permalink / raw)


Hello,

Before I start writing something too complicated, what is the best way to
allow the cursor to loop through the dired buffer?  i.e. if the cursor is
at the end of the buffer and you hit [up] (dired-next-line), then the
cursor would move to the first line; likewise for the opposite action.

Thanks,

-- 
Sebastian P. Luque

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

* Re: looping cursor position in dired
       [not found] <mailman.15691.1132260814.20277.help-gnu-emacs@gnu.org>
@ 2005-11-17 23:54 ` rgb
  2005-11-18  0:12   ` Sebastian Luque
  0 siblings, 1 reply; 3+ messages in thread
From: rgb @ 2005-11-17 23:54 UTC (permalink / raw)



Sebastian Luque wrote:
> Hello,
>
> Before I start writing something too complicated, what is the best way to
> allow the cursor to loop through the dired buffer?  i.e. if the cursor is
> at the end of the buffer and you hit [up] (dired-next-line), then the
> cursor would move to the first line; likewise for the opposite action.
>
> Thanks,

Yes it would be a shame if you did something complicated;)

(defadvice dired-next-line
  (before my-buff-wrap activate compile) "With wrapping"
  (when (eobp) (goto-char (point-min))))

(defadvice dired-previous-line
  (before my-buff-wrap activate compile) "With wrapping"
  (when (bobp) (goto-char (point-max))))

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

* Re: looping cursor position in dired
  2005-11-17 23:54 ` looping cursor position in dired rgb
@ 2005-11-18  0:12   ` Sebastian Luque
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Luque @ 2005-11-18  0:12 UTC (permalink / raw)


"rgb" <rbielaws@i1.net> wrote:

[...]

> Yes it would be a shame if you did something complicated;)

> (defadvice dired-next-line
> (before my-buff-wrap activate compile) "With wrapping"
> (when (eobp) (goto-char (point-min))))

> (defadvice dired-previous-line
> (before my-buff-wrap activate compile) "With wrapping"
> (when (bobp) (goto-char (point-max))))

Nice, thanks for both the solution and example of defadvice usage!


Thanks,

-- 
Sebastian P. Luque

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

end of thread, other threads:[~2005-11-18  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.15691.1132260814.20277.help-gnu-emacs@gnu.org>
2005-11-17 23:54 ` looping cursor position in dired rgb
2005-11-18  0:12   ` Sebastian Luque
2005-11-17 20:47 Sebastian Luque

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