* show-paren-mode / blink-matching-paren
@ 2008-08-11 8:38 Dan Davison
2008-08-11 10:42 ` Nikolaj Schumacher
0 siblings, 1 reply; 4+ messages in thread
From: Dan Davison @ 2008-08-11 8:38 UTC (permalink / raw)
To: help-gnu-emacs mailing list
q1. I'd like show-paren-mode to wait show-paren-delay seconds, then
show the matching paren, but only do so for some specified amount of
time, before going away. However, I don't see a variable specifying
how long to show the paren for. What I'm after is the following:
whenever I'm curious about what the matching paren is of some closing
paren, I can move point to after the closing paren, and it will show
me, for a second or so. Currently it's seeming to me that I can
achieve this with neither show-paren-mode nor blink-matching-paren
(which only blinks on insertion, rather than point being next to
paren). Any solutions?
q2. A basic question: In my .emacs I'd like to turn on
e.g. show-paren-mode in e.g. emacs-lisp mode only. How do I do that?
Adding (show-paren-mode t) to my personal emacs-lisp mode hook turns
it on in all buffers, right?
Thanks,
Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: show-paren-mode / blink-matching-paren
2008-08-11 8:38 show-paren-mode / blink-matching-paren Dan Davison
@ 2008-08-11 10:42 ` Nikolaj Schumacher
0 siblings, 0 replies; 4+ messages in thread
From: Nikolaj Schumacher @ 2008-08-11 10:42 UTC (permalink / raw)
To: help-gnu-emacs mailing list
Dan Davison <davison@stats.ox.ac.uk> wrote:
> What I'm after is the following:
> whenever I'm curious about what the matching paren is of some closing
> paren, I can move point to after the closing paren, and it will show
> me, for a second or so.
Call `blink-matching-open' from an idle timer.
> q2. A basic question: In my .emacs I'd like to turn on
> e.g. show-paren-mode in e.g. emacs-lisp mode only. How do I do that?
> Adding (show-paren-mode t) to my personal emacs-lisp mode hook turns
> it on in all buffers, right?
`show-paren-mode' is a global mode, so there is no obvious way.
Looking at the implementation, the following should work, though:
(show-paren-mode t)
(setq show-paren-mode nil)
And in the elisp hook:
(set (make-local-variable 'show-paren-mode) t)
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.16353.1218443902.18990.help-gnu-emacs@gnu.org>]
* Re: show-paren-mode / blink-matching-paren
[not found] <mailman.16353.1218443902.18990.help-gnu-emacs@gnu.org>
@ 2008-08-11 8:46 ` Richard G Riley
2008-08-11 10:18 ` Dan Davison
0 siblings, 1 reply; 4+ messages in thread
From: Richard G Riley @ 2008-08-11 8:46 UTC (permalink / raw)
To: help-gnu-emacs
Dan Davison <davison@stats.ox.ac.uk> writes:
> q1. I'd like show-paren-mode to wait show-paren-delay seconds, then
> show the matching paren, but only do so for some specified amount of
> time, before going away. However, I don't see a variable specifying
> how long to show the paren for. What I'm after is the following:
> whenever I'm curious about what the matching paren is of some closing
> paren, I can move point to after the closing paren, and it will show
> me, for a second or so. Currently it's seeming to me that I can
> achieve this with neither show-paren-mode nor blink-matching-paren
> (which only blinks on insertion, rather than point being next to
> paren). Any solutions?
>
> q2. A basic question: In my .emacs I'd like to turn on
> e.g. show-paren-mode in e.g. emacs-lisp mode only. How do I do that?
> Adding (show-paren-mode t) to my personal emacs-lisp mode hook turns
> it on in all buffers, right?
http://www.emacswiki.org/cgi-bin/wiki/ShowParenMode
See the bit about mode local to buffer:
,----
| To make this mode local to the buffer use (make-variable-buffer-local ‘show-paren-mode), add something like this to your .emacs:
|
| (defun lispy-parens ()
| "Setup parens display for lisp modes"
| (setq show-paren-delay 0)
| (setq show-paren-style 'parenthesis)
| (make-variable-buffer-local 'show-paren-mode)
| (show-paren-mode 1)
| (set-face-background 'show-paren-match-face (face-background 'default))
| (if (boundp 'font-lock-comment-face)
| (set-face-foreground 'show-paren-match-face
| (face-foreground 'font-lock-comment-face))
| (set-face-foreground 'show-paren-match-face
| (face-foreground 'default)))
| (set-face-foreground 'show-paren-match-face "red")
| (set-face-attribute 'show-paren-match-face nil :weight 'extra-bold))
|
| (add-hook 'scheme-mode-hook 'lispy-parens)
| (add-hook 'lisp-mode-hook 'lispy-parens)
| (add-hook 'emacs-lisp-mode-hook 'lispy-parens)
`----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: show-paren-mode / blink-matching-paren
2008-08-11 8:46 ` Richard G Riley
@ 2008-08-11 10:18 ` Dan Davison
0 siblings, 0 replies; 4+ messages in thread
From: Dan Davison @ 2008-08-11 10:18 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, Aug 11, 2008 at 10:46:22AM +0200, Richard G Riley wrote:
>
> Dan Davison <davison@stats.ox.ac.uk> writes:
>
> > q1. I'd like show-paren-mode to wait show-paren-delay seconds, then
> > show the matching paren, but only do so for some specified amount of
> > time, before going away. However, I don't see a variable specifying
> > how long to show the paren for. What I'm after is the following:
> > whenever I'm curious about what the matching paren is of some closing
> > paren, I can move point to after the closing paren, and it will show
> > me, for a second or so. Currently it's seeming to me that I can
> > achieve this with neither show-paren-mode nor blink-matching-paren
> > (which only blinks on insertion, rather than point being next to
> > paren). Any solutions?
> >
> > q2. A basic question: In my .emacs I'd like to turn on
> > e.g. show-paren-mode in e.g. emacs-lisp mode only. How do I do that?
> > Adding (show-paren-mode t) to my personal emacs-lisp mode hook turns
> > it on in all buffers, right?
>
> http://www.emacswiki.org/cgi-bin/wiki/ShowParenMode
>
> See the bit about mode local to buffer:
>
> ,----
> | To make this mode local to the buffer use (make-variable-buffer-local ???show-paren-mode), add something like this to your .emacs:
> |
> | (defun lispy-parens ()
> | "Setup parens display for lisp modes"
> | (setq show-paren-delay 0)
> | (setq show-paren-style 'parenthesis)
> | (make-variable-buffer-local 'show-paren-mode)
> | (show-paren-mode 1)
> | (set-face-background 'show-paren-match-face (face-background 'default))
> | (if (boundp 'font-lock-comment-face)
> | (set-face-foreground 'show-paren-match-face
> | (face-foreground 'font-lock-comment-face))
> | (set-face-foreground 'show-paren-match-face
> | (face-foreground 'default)))
;; > | (set-face-foreground 'show-paren-match-face "red")
> | (set-face-attribute 'show-paren-match-face nil :weight 'extra-bold))
> |
> | (add-hook 'scheme-mode-hook 'lispy-parens)
> | (add-hook 'lisp-mode-hook 'lispy-parens)
> | (add-hook 'emacs-lisp-mode-hook 'lispy-parens)
> `----
Nice. That's a lot more helpful than was my last reply to one of your
posts... One thing is that the line I've commented out above seems to
overwrite the previous expression, no? I've removed it from the
Wiki. Someone shout at me if I'm getting this wrong.
I am interested in the answer to q1, but OTOH I'm not so stressed
about it now my matching parentheses have ceased to be horrendously ugly.
Dan
--
www.stats.ox.ac.uk/~davison
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-11 10:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-11 8:38 show-paren-mode / blink-matching-paren Dan Davison
2008-08-11 10:42 ` Nikolaj Schumacher
[not found] <mailman.16353.1218443902.18990.help-gnu-emacs@gnu.org>
2008-08-11 8:46 ` Richard G Riley
2008-08-11 10:18 ` Dan Davison
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).