all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs navigation mode
@ 2012-04-02 19:01 Earendil
  2012-04-02 19:20 ` Thien-Thi Nguyen
  2012-04-02 23:59 ` Drew Adams
  0 siblings, 2 replies; 10+ messages in thread
From: Earendil @ 2012-04-02 19:01 UTC (permalink / raw)
  To: Help-gnu-emacs


Hello, I'm an Emacs newbie fascinated with this editor. I'm already
experimenting with AucTeX and Haskell modes, but I'm curious if there is a
mode that allows Visual Assist X-like buffer navigation. For those who
didn't use it -- it automatically remembers positions in buffers you were
watching long enough and lets you easily jump between them (in linear style,
not Emacs-undo-style).

I know I could probably relatively easily write it in Elisp but I think it's
so useful it just must have been already written and I just didn't know how
to name it.

Regards,
Earendil.
-- 
View this message in context: http://old.nabble.com/Emacs-navigation-mode-tp33545005p33545005.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Emacs navigation mode
  2012-04-02 19:01 Emacs navigation mode Earendil
@ 2012-04-02 19:20 ` Thien-Thi Nguyen
  2012-04-02 19:25   ` Deniz Dogan
       [not found]   ` <mailman.382.1333394753.20052.help-gnu-emacs@gnu.org>
  2012-04-02 23:59 ` Drew Adams
  1 sibling, 2 replies; 10+ messages in thread
From: Thien-Thi Nguyen @ 2012-04-02 19:20 UTC (permalink / raw)
  To: Earendil; +Cc: Help-gnu-emacs

() Earendil <matcio1@gmail.com>
() Mon, 2 Apr 2012 12:01:15 -0700 (PDT)

   remembers positions in buffers you were
   watching long enough

I don't understand what this means.
Could you give an example of this behavior?
Is "long enough" configurable in some way?



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

* Re: Emacs navigation mode
  2012-04-02 19:20 ` Thien-Thi Nguyen
@ 2012-04-02 19:25   ` Deniz Dogan
  2012-04-02 19:26     ` Deniz Dogan
       [not found]     ` <mailman.383.1333394813.20052.help-gnu-emacs@gnu.org>
       [not found]   ` <mailman.382.1333394753.20052.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 10+ messages in thread
From: Deniz Dogan @ 2012-04-02 19:25 UTC (permalink / raw)
  To: help-gnu-emacs

On 2012-04-02 21:20, Thien-Thi Nguyen wrote:
> () Earendil<matcio1@gmail.com>
> () Mon, 2 Apr 2012 12:01:15 -0700 (PDT)
>
>     remembers positions in buffers you were
>     watching long enough
>
> I don't understand what this means.
> Could you give an example of this behavior?
> Is "long enough" configurable in some way?
>

If you've been viewing a buffer portion for longer than N seconds, store 
a rough estimate of the buffer and the position in a data structure 
somewhere for later use.



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

* Re: Emacs navigation mode
  2012-04-02 19:25   ` Deniz Dogan
@ 2012-04-02 19:26     ` Deniz Dogan
       [not found]     ` <mailman.383.1333394813.20052.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Deniz Dogan @ 2012-04-02 19:26 UTC (permalink / raw)
  To: help-gnu-emacs

On 2012-04-02 21:25, Deniz Dogan wrote:
> On 2012-04-02 21:20, Thien-Thi Nguyen wrote:
>> () Earendil<matcio1@gmail.com>
>> () Mon, 2 Apr 2012 12:01:15 -0700 (PDT)
>>
>> remembers positions in buffers you were
>> watching long enough
>>
>> I don't understand what this means.
>> Could you give an example of this behavior?
>> Is "long enough" configurable in some way?
>>
>
> If you've been viewing a buffer portion for longer than N seconds, store
> a rough estimate of the buffer and the position in a data structure
> somewhere for later use.
>

The buffer and a rough estimate of the buffer position*



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

* Re: Emacs navigation mode
       [not found]   ` <mailman.382.1333394753.20052.help-gnu-emacs@gnu.org>
@ 2012-04-02 20:04     ` Barry Margolin
  0 siblings, 0 replies; 10+ messages in thread
From: Barry Margolin @ 2012-04-02 20:04 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.382.1333394753.20052.help-gnu-emacs@gnu.org>,
 Deniz Dogan <deniz@dogan.se> wrote:

> On 2012-04-02 21:20, Thien-Thi Nguyen wrote:
> > () Earendil<matcio1@gmail.com>
> > () Mon, 2 Apr 2012 12:01:15 -0700 (PDT)
> >
> >     remembers positions in buffers you were
> >     watching long enough
> >
> > I don't understand what this means.
> > Could you give an example of this behavior?
> > Is "long enough" configurable in some way?
> >
> 
> If you've been viewing a buffer portion for longer than N seconds, store 
> a rough estimate of the buffer and the position in a data structure 
> somewhere for later use.

In Emacs, the way this is addressed is that commands that are likely to 
cause a big change in buffer position usually save the previous position 
automatically in the mark ring.  For instance, type M-> to jump to the 
end of the buffer, and it will display "Mark set".  The same thing 
happens when you perform a search.

You can then walk back through the mark ring by typing C-u C-space 
repeatedly until you get to the saved position you care about.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: Emacs navigation mode
       [not found]     ` <mailman.383.1333394813.20052.help-gnu-emacs@gnu.org>
@ 2012-04-02 21:27       ` Rud1ger Sch1erz
  2012-04-02 23:03         ` Madan Ramakrishnan
  0 siblings, 1 reply; 10+ messages in thread
From: Rud1ger Sch1erz @ 2012-04-02 21:27 UTC (permalink / raw)
  To: help-gnu-emacs

Deniz Dogan <deniz@dogan.se> writes:

> The buffer and a rough estimate of the buffer position*

You can store position in a buffer using the command
`point-to-register', which is usually bound to `C-x r SPC'.

To jump back to this position in that buffer, you can use
`jump-to-register', bound to `C-x r j'.

However, I don't know about automagically storing of position, depending
on time, staying at a location.

-- 
Tschau
Rüdiger

Achtung, dieser Artikel ist mit sublimalen Werbeeinblendungen hinterlegt.


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

* Re: Emacs navigation mode
  2012-04-02 21:27       ` Rud1ger Sch1erz
@ 2012-04-02 23:03         ` Madan Ramakrishnan
  0 siblings, 0 replies; 10+ messages in thread
From: Madan Ramakrishnan @ 2012-04-02 23:03 UTC (permalink / raw)
  To: Rud1ger Sch1erz; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Perhaps combine that with run-with-idle-timer?

Madan R.

On Mon, Apr 2, 2012 at 5:27 PM, Rud1ger Sch1erz <nospam_tigre@yahoo.es>wrote:

> Deniz Dogan <deniz@dogan.se> writes:
>
> > The buffer and a rough estimate of the buffer position*
>
> You can store position in a buffer using the command
> `point-to-register', which is usually bound to `C-x r SPC'.
>
> To jump back to this position in that buffer, you can use
> `jump-to-register', bound to `C-x r j'.
>
> However, I don't know about automagically storing of position, depending
> on time, staying at a location.
>
> --
> Tschau
> Rüdiger
>
> Achtung, dieser Artikel ist mit sublimalen Werbeeinblendungen hinterlegt.
>

[-- Attachment #2: Type: text/html, Size: 1117 bytes --]

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

* RE: Emacs navigation mode
  2012-04-02 19:01 Emacs navigation mode Earendil
  2012-04-02 19:20 ` Thien-Thi Nguyen
@ 2012-04-02 23:59 ` Drew Adams
  2012-04-04 13:32   ` M B
  1 sibling, 1 reply; 10+ messages in thread
From: Drew Adams @ 2012-04-02 23:59 UTC (permalink / raw)
  To: 'Earendil', Help-gnu-emacs

> automatically remembers positions in buffers you were
> watching long enough and lets you easily jump between them 
> (in linear style, not Emacs-undo-style).

I guess you mean that if Emacs is idle for a given amount of time then the
position of the cursor (or perhaps its current line) is automatically remembered
on a list, and you can navigate to positions on the list.

1. Without the automatic remembering part there are a number of possibilities,
including bookmarking and setting markers.  IOW, some explicit user action sets
a bookmark or sets a marker.

See the Emacs Wiki for different possibilities: 
http://emacswiki.org/emacs/BookMarks
http://emacswiki.org/emacs/MarkCommand


2. For the automatic-remembering part, you can put the bookmark-setting action
on an idle timer.  IOW, have Emacs automatically set a bookmark or a marker
whenever Emacs is idle for a given delay.

For bookmarks, if you use Bookmark+ then you can use persistent or temporary
bookmarks, including with automatic naming if you like (with the position in the
name).  You can have them show up visually (be highlighted) or not.  You can
cycle among any set of bookmarks.  See below for an example.

With Bookmark+ you can easily navigate among bookmarks: cycling, direct access,
access using completion.  With Icicles you can do the same with Emacs markers
(local or global).  With both libraries, navigating among bookmarks is even
easier.

http://emacswiki.org/emacs/MarkCommands#IciclesGoToMarker (navigate/cycle among
markers)

http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus#toc47 (bookmark navigation
lists & cycling)


A quick example thrown together to show one way of doing automatic idle
bookmarking with Bookmark+ (http://emacswiki.org/emacs/BookmarkPlus):

1. (Optional) To make autonamed bookmarks always be temporary (not saved),
customize option `bmkp-autotemp-bookmark-predicates' to include
`bmkp-autonamed-bookmark-p'.  To test, you can just do this:

(setq bmkp-autotemp-bookmark-predicates  '(bmkp-autonamed-bookmark-p))

2. (Optional) To highlight autonamed bookmarks when they are set, customize
option `bmkp-auto-light-when-set' to `autonamed-bookmark'.  To test, you can
just do this:

(setq bmkp-auto-light-when-set 'autonamed-bookmark)

3. Define the number of idle seconds before setting a bookmark:

(defcustom auto-idle-bookmark-mode-delay 30
  "Secs before automatically setting a bookmark."
  :type 'integer :group 'bookmark-plus)

4. Define an idle timer:

(defvar auto-idle-bookmark-mode-timer
  (progn (when (timerp 'auto-idle-bookmark-mode-timer)
           (cancel-timer auto-idle-bookmark-mode-timer))
         (prog1 (run-with-idle-timer
                 auto-idle-bookmark-mode-delay t
                 #'bmkp-set-autonamed-bookmark-at-line)
           (when (timerp 'auto-idle-bookmark-mode-timer)
             (cancel-timer auto-idle-bookmark-mode-timer))))
  "Timer for `auto-idle-bookmark-mode'.")

5. Define a command to turn automatic bookmarking on/off:

(define-minor-mode auto-idle-bookmark-mode
    "Toggle automatic setting of a bookmark when Emacs is idle"
  :init-value nil :global t :lighter " BMK"
  (cancel-timer auto-idle-bookmark-mode-timer)
  (when auto-idle-bookmark-mode
    (setq auto-idle-bookmark-mode-timer
          (run-with-idle-timer
           auto-idle-bookmark-mode-delay t
           #'bmkp-set-autonamed-bookmark-at-line))))

6. Turn it on: `M-x auto-idle-bookmark-mode'.

7. To cycle among the bookmarks in the current buffer, use `C-x p down' (`down'
`down'...), or `up'.  If you have Icicles, you can navigate more flexibly,
combining direct access with cycling and completion.

8. The function used in #5 to set a bookmark is
`bmkp-set-autonamed-bookmark-at-line'.  It sets it at the beginning of the
current line.  If you instead want to bookmark at point, so you can have more
than one such bookmark on the same line, then use `bmkp-set-autonamed-bookmark'
(no `-at-line').

9. Because of #1, all of the bookmarks created this way are temporary: not saved
to your bookmarks file.  You can also delete them all at anytime using `M-x
bmkp-delete-all-temporary-bookmarks'.  You can also delete any of them
individually by putting the cursor on its line (or its position, if you don't
use (`-at-line') and hitting `C-x p RET' - this key creates/deletes an autonamed
bookmark at point.

10. If you do not want to highlight the bookmarks, don't do #2.  If you want to
unhighlight them at any time, use `C-x p u' (all in the buffer) or `C-x p C-u'
(the bookmark on the same line as cursor).  See also `C-x p U'.

HTH.




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

* Re: Emacs navigation mode
  2012-04-02 23:59 ` Drew Adams
@ 2012-04-04 13:32   ` M B
  2012-04-05 15:12     ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: M B @ 2012-04-04 13:32 UTC (permalink / raw)
  To: Help-gnu-emacs, Drew Adams

Thanks for quick and helpful response, these bookmarks look promising.  
With the code for idle timer and toggling this on and off customizing it  
to suit my taste should be quite easy.

Regards,
Earendil



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

* RE: Emacs navigation mode
  2012-04-04 13:32   ` M B
@ 2012-04-05 15:12     ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2012-04-05 15:12 UTC (permalink / raw)
  To: 'M B', Help-gnu-emacs

> Thanks for quick and helpful response, these bookmarks look 
> promising.  With the code for idle timer and toggling this
> on and off customizing it to suit my taste should be quite easy.

Earendil (& others),

Just FYI.  I added some code for such automatic bookmarking to Bookmark+.
Letting you know mainly because I corrected a bug in the code that I had posted
earlier to help-gnu-emacs: The defvar for the timer variable was incorrect,
resulting in the mode always being on, in effect. ;-)

HTH - Drew




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

end of thread, other threads:[~2012-04-05 15:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 19:01 Emacs navigation mode Earendil
2012-04-02 19:20 ` Thien-Thi Nguyen
2012-04-02 19:25   ` Deniz Dogan
2012-04-02 19:26     ` Deniz Dogan
     [not found]     ` <mailman.383.1333394813.20052.help-gnu-emacs@gnu.org>
2012-04-02 21:27       ` Rud1ger Sch1erz
2012-04-02 23:03         ` Madan Ramakrishnan
     [not found]   ` <mailman.382.1333394753.20052.help-gnu-emacs@gnu.org>
2012-04-02 20:04     ` Barry Margolin
2012-04-02 23:59 ` Drew Adams
2012-04-04 13:32   ` M B
2012-04-05 15:12     ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.