all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* repeat-on-final-keystroke
@ 2006-04-21 13:45 Enzo Vitale
  2006-04-21 21:23 ` repeat-on-final-keystroke Leon
  0 siblings, 1 reply; 9+ messages in thread
From: Enzo Vitale @ 2006-04-21 13:45 UTC (permalink / raw)


Dear Emacs experts,

I have rebound the 'bs-cycle-next' command to 'C-x b' and I would very
much like it to behave as 'repeat' in the sense that continuing to
press
simply the last character of the key-binding ('b' in this case) had
the effect of scrolling one by one the list of active buffers.

Currently, I have to retype 'C-x b' each time, very annoying when
editing tens of different buffers, which is typical for me during code
development.

By the way, the same would also be very useful with the 'undo' command
(C-x u), and probably many more...

Is this possible ?

Thank you,
Enzo

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

* Re: repeat-on-final-keystroke
  2006-04-21 13:45 repeat-on-final-keystroke Enzo Vitale
@ 2006-04-21 21:23 ` Leon
  0 siblings, 0 replies; 9+ messages in thread
From: Leon @ 2006-04-21 21:23 UTC (permalink / raw)


Enzo Vitale <enzo.vitale@epfl.ch> writes:

> Dear Emacs experts,
>
> I have rebound the 'bs-cycle-next' command to 'C-x b' and I would very
> much like it to behave as 'repeat' in the sense that continuing to
> press
> simply the last character of the key-binding ('b' in this case) had
> the effect of scrolling one by one the list of active buffers.
>
> Currently, I have to retype 'C-x b' each time, very annoying when
> editing tens of different buffers, which is typical for me during code
> development.
>
> By the way, the same would also be very useful with the 'undo' command
> (C-x u), and probably many more...
>
> Is this possible ?
>
> Thank you,
> Enzo

C-x Esc Esc

-- 
Leon

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

* Re: repeat-on-final-keystroke
       [not found] <mailman.732.1145653193.9609.help-gnu-emacs@gnu.org>
@ 2006-04-22 20:32 ` liyer.vijay
  2006-04-24 10:40 ` repeat-on-final-keystroke Oliver Scholz
  2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
  2 siblings, 0 replies; 9+ messages in thread
From: liyer.vijay @ 2006-04-22 20:32 UTC (permalink / raw)


You could also do C-x b C-x z z z z z...

Instead of C-x u you could also use C-_ or C-/ for undoing.

Cheers
Vijay

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

* Re: repeat-on-final-keystroke
       [not found] <mailman.732.1145653193.9609.help-gnu-emacs@gnu.org>
  2006-04-22 20:32 ` repeat-on-final-keystroke liyer.vijay
@ 2006-04-24 10:40 ` Oliver Scholz
  2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
  2 siblings, 0 replies; 9+ messages in thread
From: Oliver Scholz @ 2006-04-24 10:40 UTC (permalink / raw)


Enzo Vitale <enzo.vitale@epfl.ch> writes:

> Dear Emacs experts,
>
> I have rebound the 'bs-cycle-next' command to 'C-x b' and I would very
> much like it to behave as 'repeat' in the sense that continuing to
> press
> simply the last character of the key-binding ('b' in this case) had
> the effect of scrolling one by one the list of active buffers.
>
> Currently, I have to retype 'C-x b' each time, very annoying when
> editing tens of different buffers, which is typical for me during code
> development.

IMNSHO, if you have tens of different buffers, you need something more
efficient than buffer cycling ... well, there is no accounting for
taste.

> By the way, the same would also be very useful with the 'undo' command
> (C-x u), and probably many more...

Use `C-/' for undo then.

> Is this possible ?

The way to find this out is by looking at the definition of functions
which already do this, like `repeat'. After cursory skimming it, I'd
say offhand that for your purpose it is sufficient to tinker with
`last-input-event', `read-event' and `unread-command-events'. For
instance:

(defun my-bs-cycle-next ()
  (interactive)
  (let ((dont-stop t))
    (bs-cycle-next)
    (while dont-stop
      (let ((last last-input-event)
            (event (read-event)))
        (if (eq event last)
            (bs-cycle-next)
          (push event unread-command-events)
          (setq dont-stop nil))))))

(define-key global-map (kbd "C-c b") #'my-bs-cycle-next)



    Oliver
-- 
5 Floréal an 214 de la Révolution
Liberté, Egalité, Fraternité!

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

* Re: repeat-on-final-keystroke
       [not found] <mailman.732.1145653193.9609.help-gnu-emacs@gnu.org>
  2006-04-22 20:32 ` repeat-on-final-keystroke liyer.vijay
  2006-04-24 10:40 ` repeat-on-final-keystroke Oliver Scholz
@ 2006-04-24 15:37 ` B. T. Raven
  2006-04-24 16:25   ` repeat-on-final-keystroke Kevin Rodgers
                     ` (2 more replies)
  2 siblings, 3 replies; 9+ messages in thread
From: B. T. Raven @ 2006-04-24 15:37 UTC (permalink / raw)



"Enzo Vitale" <enzo.vitale@epfl.ch> wrote in message
news:mailman.732.1145653193.9609.help-gnu-emacs@gnu.org...
> Dear Emacs experts,
>
> I have rebound the 'bs-cycle-next' command to 'C-x b' and I would very
> much like it to behave as 'repeat' in the sense that continuing to
> press
> simply the last character of the key-binding ('b' in this case) had
> the effect of scrolling one by one the list of active buffers.
>
> Currently, I have to retype 'C-x b' each time, very annoying when
> editing tens of different buffers, which is typical for me during code
> development.
>
> By the way, the same would also be very useful with the 'undo' command
> (C-x u), and probably many more...
>
> Is this possible ?
>
> Thank you,
> Enzo
>
>

For that many buffers it seems like iswitchb would work better if you
could use a naming convention that made the names differ more at the
beginning of the string than at the end. This might not be convenient
unless you could get used to reading the buffer names backwards  a l'arabe
(i.e. "h.sfed" for "defs.h" by performing reverse-string of file name to
get buffer name).  You can also filter out *Help, *Info, and other
read-only buffers with iswitch.

If you can set up a super key modifier, you could cycle through the
buffers by adding

(global-set-key [(super b)] 'bury-buffer)

to your .emacs, but this has the undesirable side effect of removing the
names from the menu bar buffer list. It does however require only one
keypress per buffer switch if you don't count holding down the super key
continously as a keypress.

Ed.

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

* Re: repeat-on-final-keystroke
  2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
@ 2006-04-24 16:25   ` Kevin Rodgers
  2006-04-24 16:31   ` repeat-on-final-keystroke Drew Adams
       [not found]   ` <mailman.870.1145895999.9609.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2006-04-24 16:25 UTC (permalink / raw)


B. T. Raven wrote:
> If you can set up a super key modifier, you could cycle through the
> buffers by adding
> 
> (global-set-key [(super b)] 'bury-buffer)
> 
> to your .emacs, but this has the undesirable side effect of removing the
> names from the menu bar buffer list.

Assuming you've got more buffers than buffers-menu-max-size, which
defaults to 10, right?

-- 
Kevin Rodgers
Sr. Software Engineer, IHS

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

* RE: repeat-on-final-keystroke
  2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
  2006-04-24 16:25   ` repeat-on-final-keystroke Kevin Rodgers
@ 2006-04-24 16:31   ` Drew Adams
       [not found]   ` <mailman.870.1145895999.9609.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2006-04-24 16:31 UTC (permalink / raw)


    > editing tens of different buffers, which is typical for me

    For that many buffers it seems like iswitchb would work better if you
    could use a naming convention that made the names differ more at the
    beginning of the string than at the end.

Hack! Cough!

    This might not be convenient
    unless you could get used to reading the buffer names backwards
     a l'arabe
    (i.e. "h.sfed" for "defs.h" by performing reverse-string of file name to
    get buffer name).

In that case it _would_ be convenient? Argggh!

    You can also filter out *Help, *Info, and other
    read-only buffers with iswitch...

Try Icicles. It's designed to be useful with large numbers of completion
candidates (in this case, buffer names). No need to jump through hoops to
finagle buffer names so they have prefixes that follow some convention, read
their names backward, or any such witchcraft.

In addition to the prefix matching of vanilla Emacs, Icicles gives you
apropos-style matching. You can 1) match any substring of the name (in fact,
you can match any regexp against the name), and you can 2) cycle among those
matches. With a large number of candidates, you typically use apropos
matching to narrow the choices and then you might cycle among the remaining
candidates using a single key (e.g. `next').

Does "regexp matching" sound scary, complicated, difficult? 1) Don't forget
that _any_ string of letters, numbers and such is also a regexp, so this
gives you substring matching without doing anything special. 2) With
Icicles, you can use one simple regexp (e.g. just a substring) to filter,
and then use another simple regexp (e.g. another substring) to filter
further, and so on - any number of times. This is just like doing grep plant
*.txt | grep food | grep mineral: you can find multiple substrings of a
buffer name (or file name or...) that might appear in any order within the
name.

Here is the doc (which has a link to the library files):
http://www.emacswiki.org/cgi-bin/wiki/Icicles. Have fun!

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

* Re: repeat-on-final-keystroke
       [not found]   ` <mailman.870.1145895999.9609.help-gnu-emacs@gnu.org>
@ 2006-04-24 19:56     ` B. T. Raven
  0 siblings, 0 replies; 9+ messages in thread
From: B. T. Raven @ 2006-04-24 19:56 UTC (permalink / raw)



"Kevin Rodgers" <ihs_4664@yahoo.com> wrote in message
news:mailman.870.1145895999.9609.help-gnu-emacs@gnu.org...
> B. T. Raven wrote:
> > If you can set up a super key modifier, you could cycle through the
> > buffers by adding
> >
> > (global-set-key [(super b)] 'bury-buffer)
> >
> > to your .emacs, but this has the undesirable side effect of removing
the
> > names from the menu bar buffer list.
>
> Assuming you've got more buffers than buffers-menu-max-size, which
> defaults to 10, right?

No. In ver. 21.3 on w32 each buffer that is buried is taken off the
buffers-menu list. It can be put back on by clicking on it in the *Buffer
List* buffer. I don't know enough to say whethen that is a feature or a
bug.

Ed.

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

* Re: repeat-on-final-keystroke
       [not found] <mailman.871.1145896319.9609.help-gnu-emacs@gnu.org>
@ 2006-04-24 22:05 ` B. T. Raven
  0 siblings, 0 replies; 9+ messages in thread
From: B. T. Raven @ 2006-04-24 22:05 UTC (permalink / raw)



"Drew Adams" <drew.adams@oracle.com> wrote in message
news:mailman.871.1145896319.9609.help-gnu-emacs@gnu.org...
>     > editing tens of different buffers, which is typical for me
>
>     For that many buffers it seems like iswitchb would work better if
you
>     could use a naming convention that made the names differ more at the
>     beginning of the string than at the end.
>
> Hack! Cough!

But for non-programers it's usually the case that only a few buffers are
needed. And I don't think that emacs or most os's care whether a file is
called chap1 or 1chap.

>
>     This might not be convenient
>     unless you could get used to reading the buffer names backwards
>      a l'arabe
>     (i.e. "h.sfed" for "defs.h" by performing reverse-string of file
name to
>     get buffer name).
>
> In that case it _would_ be convenient? Argggh!

No of course not. It's not only ugly, it's downright perverse. Just
thinking out loud. I'm a palindrome fan.

>
>     You can also filter out *Help, *Info, and other
>     read-only buffers with iswitch...
>
> Try Icicles. It's designed to be useful with large numbers of completion
> candidates (in this case, buffer names). No need to jump through hoops
to
> finagle buffer names so they have prefixes that follow some convention,
read
> their names backward, or any such witchcraft.
>
> In addition to the prefix matching of vanilla Emacs, Icicles gives you
> apropos-style matching. You can 1) match any substring of the name (in
fact,
> you can match any regexp against the name), and you can 2) cycle among
those
> matches. With a large number of candidates, you typically use apropos
> matching to narrow the choices and then you might cycle among the
remaining
> candidates using a single key (e.g. `next').
>
> Does "regexp matching" sound scary, complicated, difficult? 1) Don't
forget
> that _any_ string of letters, numbers and such is also a regexp, so this
> gives you substring matching without doing anything special. 2) With
> Icicles, you can use one simple regexp (e.g. just a substring) to
filter,
> and then use another simple regexp (e.g. another substring) to filter
> further, and so on - any number of times. This is just like doing grep
plant
> *.txt | grep food | grep mineral: you can find multiple substrings of a
> buffer name (or file name or...) that might appear in any order within
the
> name.
>
> Here is the doc (which has a link to the library files):
> http://www.emacswiki.org/cgi-bin/wiki/Icicles. Have fun!

I'm sure this is closer to what the OP really needs. I don't have any use
for it since I don't edit that many files simultaneously so it's overkill
for me to add a lot of things that aren't part of emacs as it comes out of
the box. Maybe Auctex would be a good idea though.

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

end of thread, other threads:[~2006-04-24 22:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.732.1145653193.9609.help-gnu-emacs@gnu.org>
2006-04-22 20:32 ` repeat-on-final-keystroke liyer.vijay
2006-04-24 10:40 ` repeat-on-final-keystroke Oliver Scholz
2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
2006-04-24 16:25   ` repeat-on-final-keystroke Kevin Rodgers
2006-04-24 16:31   ` repeat-on-final-keystroke Drew Adams
     [not found]   ` <mailman.870.1145895999.9609.help-gnu-emacs@gnu.org>
2006-04-24 19:56     ` repeat-on-final-keystroke B. T. Raven
     [not found] <mailman.871.1145896319.9609.help-gnu-emacs@gnu.org>
2006-04-24 22:05 ` repeat-on-final-keystroke B. T. Raven
2006-04-21 13:45 repeat-on-final-keystroke Enzo Vitale
2006-04-21 21:23 ` repeat-on-final-keystroke Leon

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.