[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposed extension of show-paren-mode: Highlight parens when point i
From: |
João Távora |
Subject: |
Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin. |
Date: |
Tue, 14 Oct 2014 22:50:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (darwin) |
Alan Mackenzie <address@hidden> writes:
> This is an idea which struck me when I was reading CC Mode code. I find
> myself frequently scrolling through it, and frequently wanting to know
> where the matching paren for one at beginning of indentation is. That
> involved me typing M-m an awful lot, and I've got tired of doing that.
I've gotten tired of that too, but I took a different approach (perhaps
one that has already been discussed here?)
(global-set-key [remap move-beginning-of-line]
'joaot/move-beginning-of-line)
(defun joaot/move-beginning-of-line ()
(interactive)
(let ((pos (point)))
(back-to-indentation)
(when (= pos (point)) (move-beginning-of-line nil))))
If the code is not self-explanatory enough, it makes C-a do-what-I-mean:
The first C-a brings me to start of indentation, a second one forces a
move to the proper beginning of line.
It solves this problem because C-a is perhaps the most ergonomic binding
of all, provided you remap caps-lock to control.
Of course, Alan, your solution requires no typing at all, but it also
does not solve the almost-as-common problem that you might want to move
the cursor to the opening parenthesis.
This is the single feature that I miss most when using other people's
emacsen or Emacs -Q. It's the only piece of editor that I keep around
since I switched to Emacs 10 years ago, from Eclipse, which had (has?)
this on by default. I also used to have it on C-e, but I don't miss that
nearly as much.
Its current implementation as a separate command is slightly brittle for
modes that remap C-a such, as `message-mode', so I wonder if it could be
integrated in Emacs's own `move-beginning-of-line' via a suitably named
customization variable.
What do you think?
João
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., (continued)
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Andy Moreton, 2014/10/15
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Stefan Monnier, 2014/10/15
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Alan Mackenzie, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Stefan Monnier, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Alan Mackenzie, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Stefan Monnier, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Alan Mackenzie, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Stefan Monnier, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Alan Mackenzie, 2014/10/16
- Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin., Stefan Monnier, 2014/10/16
Re: Proposed extension of show-paren-mode: Highlight parens when point is in L or R margin.,
João Távora <=