* skeleton-pair-insert-maybe parenthesis in cc-mode
@ 2007-03-05 18:47 stuart.tett
2007-03-05 19:09 ` weber
0 siblings, 1 reply; 4+ messages in thread
From: stuart.tett @ 2007-03-05 18:47 UTC (permalink / raw)
To: help-gnu-emacs
Hi, I've added code to my dotemacs file to use the skeleton-pair-
insert-maybe for quotes,parenthesis,brackets,etc.
For buffers that are in cc-mode, it only works with quotes, single
quotes, and brackets "[]". It doesn't work for parenthesis or braces
"{}"
In other modes, though, they all seem to work fine.
Does, cc-mode disable these somehow? How can I override those
settings.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton-pair-insert-maybe parenthesis in cc-mode
2007-03-05 18:47 skeleton-pair-insert-maybe parenthesis in cc-mode stuart.tett
@ 2007-03-05 19:09 ` weber
2007-03-06 0:56 ` stuart.tett
0 siblings, 1 reply; 4+ messages in thread
From: weber @ 2007-03-05 19:09 UTC (permalink / raw)
To: help-gnu-emacs
On 5 mar, 10:47, "stuart.t...@gmail.com" <stuart.t...@gmail.com>
wrote:
> Hi, I've added code to my dotemacs file to use the skeleton-pair-
> insert-maybe for quotes,parenthesis,brackets,etc.
> For buffers that are in cc-mode, it only works with quotes, single
> quotes, and brackets "[]". It doesn't work for parenthesis or braces
> "{}"
>
> In other modes, though, they all seem to work fine.
>
> Does, cc-mode disable these somehow? How can I override those
> settings.
>
> Thanks.
Check what is returned for '(' with C-h k and tell us.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton-pair-insert-maybe parenthesis in cc-mode
2007-03-05 19:09 ` weber
@ 2007-03-06 0:56 ` stuart.tett
2007-03-07 4:58 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: stuart.tett @ 2007-03-06 0:56 UTC (permalink / raw)
To: help-gnu-emacs
( runs the command c-electric-paren
which is an interactive compiled Lisp function in `cc-cmds.el'.
It is bound to ), (.
When I am in a cc-mode file it returns:
(c-electric-paren arg)
Insert a parenthesis.
If `c-syntactic-indentation' and `c-electric-flag' are both non-nil,
the
line is reindented unless a numeric arg is supplied, or the
parenthesis
is inserted inside a literal.
Whitespace between a function name and the parenthesis may get added
or
removed; see the variable `c-cleanup-list'.
Also, if `c-electric-flag' and `c-auto-newline' are both non-nil, some
newline cleanups are done if appropriate; see the variable `c-cleanup-
list'.
In the *scratch* buffer it returns:
( runs the command skeleton-pair-insert-maybe
which is an interactive compiled Lisp function in `skeleton.el'.
It is bound to {, [, <, (, ', ".
(skeleton-pair-insert-maybe arg)
Insert the character you type arg times.
With no arg, if `skeleton-pair' is non-nil, pairing can occur. If the
region
is visible the pair is wrapped around it depending on `skeleton-
autowrap'.
Else, if `skeleton-pair-on-word' is non-nil or we are not before or
inside a
word, and if `skeleton-pair-filter-function' returns nil, pairing is
performed.
Pairing is also prohibited if we are right after a quoting character
such as backslash.
If a match is found in `skeleton-pair-alist', that is inserted, else
the defaults are used. These are (), [], {}, <> and `' for the
symmetrical ones, and the same character twice for the others.
On Mar 5, 1:09 pm, "weber" <hug...@gmail.com> wrote:
> On 5 mar, 10:47, "stuart.t...@gmail.com" <stuart.t...@gmail.com>
> wrote:
>
> > Hi, I've added code to my dotemacs file to use the skeleton-pair-
> > insert-maybe for quotes,parenthesis,brackets,etc.
> > For buffers that are in cc-mode, it only works with quotes, single
> > quotes, and brackets "[]". It doesn't work for parenthesis or braces
> > "{}"
>
> > In other modes, though, they all seem to work fine.
>
> > Does, cc-mode disable these somehow? How can I override those
> > settings.
>
> > Thanks.
>
> Check what is returned for '(' with C-h k and tell us.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton-pair-insert-maybe parenthesis in cc-mode
2007-03-06 0:56 ` stuart.tett
@ 2007-03-07 4:58 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2007-03-07 4:58 UTC (permalink / raw)
To: help-gnu-emacs
[Please don't top-post.]
stuart.tett@gmail.com wrote:
> ( runs the command c-electric-paren
> which is an interactive compiled Lisp function in `cc-cmds.el'.
> It is bound to ), (.
> When I am in a cc-mode file it returns:
>
> (c-electric-paren arg)
>
> Insert a parenthesis.
>
> If `c-syntactic-indentation' and `c-electric-flag' are both non-nil,
> the
> line is reindented unless a numeric arg is supplied, or the
> parenthesis
> is inserted inside a literal.
>
> Whitespace between a function name and the parenthesis may get added
> or
> removed; see the variable `c-cleanup-list'.
>
> Also, if `c-electric-flag' and `c-auto-newline' are both non-nil, some
> newline cleanups are done if appropriate; see the variable `c-cleanup-
> list'.
>
> In the *scratch* buffer it returns:
>
> ( runs the command skeleton-pair-insert-maybe
> which is an interactive compiled Lisp function in `skeleton.el'.
> It is bound to {, [, <, (, ', ".
> (skeleton-pair-insert-maybe arg)
>
> Insert the character you type arg times.
>
> With no arg, if `skeleton-pair' is non-nil, pairing can occur. If the
> region
> is visible the pair is wrapped around it depending on `skeleton-
> autowrap'.
> Else, if `skeleton-pair-on-word' is non-nil or we are not before or
> inside a
> word, and if `skeleton-pair-filter-function' returns nil, pairing is
> performed.
> Pairing is also prohibited if we are right after a quoting character
> such as backslash.
>
> If a match is found in `skeleton-pair-alist', that is inserted, else
> the defaults are used. These are (), [], {}, <> and `' for the
> symmetrical ones, and the same character twice for the others.
Isn't it obvious:
(add-hook 'c-mode-common-hook
(lambda ()
(local-set-key "(" 'skeleton-pair-insert-maybe)))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-03-07 4:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05 18:47 skeleton-pair-insert-maybe parenthesis in cc-mode stuart.tett
2007-03-05 19:09 ` weber
2007-03-06 0:56 ` stuart.tett
2007-03-07 4:58 ` Kevin Rodgers
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).