From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Insert character pairs
Date: Sat, 01 May 2004 02:22:22 +0300 [thread overview]
Message-ID: <87ad0tyrsu.fsf@mail.jurta.org> (raw)
In-Reply-To: <m1k6zxshts.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "30 Apr 2004 09:43:23 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>>>> The following patch generalizes the function `insert-parentheses'
>>>>> Why not start from skeleton-insert-paren-maybe ?
>>>> It doesn't work with key modifiers.
>>> That why I said "start" rather than "use". I know it requires changes.
>> I am not sure that the meaning of arguments of `skeleton-insert-paren-maybe'
>> should be redefined.
> That's why I said "start with" rather than "change".
> Anyway, it's not like it makes any real difference.
Creating a function similar to `insert-parentheses' is very easy.
The following diff shows the needed changes (note that I don't propose
to change the existing function, this diff only demonstrates
the differences between the existing function and the new
`skeleton-pair-insert' function):
-(defun skeleton-pair-insert-maybe (arg)
+(defun skeleton-pair-insert (arg)
(interactive "*P")
- (if (or arg (not skeleton-pair))
+ (if (not skeleton-pair)
(self-insert-command (prefix-numeric-value arg))
(let* ((mark (and skeleton-autowrap
(or (eq last-command 'mouse-drag-region)
(and transient-mark-mode mark-active))))
(skeleton-end-hook)
- (char last-command-char)
+ (char (event-basic-type last-command-event))
(skeleton (or (assq char skeleton-pair-alist)
(assq char skeleton-pair-default-alist)
`(,char _ ,char))))
(if (or (memq (char-syntax (preceding-char)) '(?\\ ?/))
(and (not mark)
(or overwrite-mode
(if (not skeleton-pair-on-word) (looking-at "\\w"))
(funcall skeleton-pair-filter))))
(self-insert-command (prefix-numeric-value arg))
- (skeleton-insert (cons nil skeleton) (if mark -1))))))
+ (skeleton-insert (cons nil skeleton) (if mark -1 (prefix-numeric-value arg)))))))
But I think my changes in `insert-parentheses' are useful too,
because these function are still different: `skeleton-insert'
counts words, but `insert-parentheses' counts s-expressions.
And there are other less important differences.
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2004-04-30 23:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-29 8:48 Insert character pairs Juri Linkov
2004-04-29 10:12 ` Andreas Schwab
2004-04-29 11:00 ` Juri Linkov
2004-04-29 11:21 ` Andreas Schwab
2004-04-29 11:59 ` Juri Linkov
2004-04-29 14:24 ` Stefan Monnier
2004-04-29 15:02 ` Juri Linkov
2004-04-29 16:57 ` Stefan Monnier
2004-04-30 0:48 ` Juri Linkov
2004-04-30 13:43 ` Stefan Monnier
2004-04-30 23:22 ` Juri Linkov [this message]
2004-05-01 8:19 ` Juri Linkov
2004-05-02 16:19 ` Juri Linkov
2004-05-03 14:03 ` Richard Stallman
2004-05-04 15:57 ` Johan Bockgård
2004-05-04 16:48 ` Juri Linkov
2004-05-05 20:20 ` Richard Stallman
2004-05-06 13:14 ` Juri Linkov
2004-05-06 17:19 ` Stefan Monnier
2004-05-08 21:43 ` Juri Linkov
2004-05-03 19:48 ` Kevin Rodgers
2004-05-04 5:51 ` Juri Linkov
2004-05-04 18:30 ` Kevin Rodgers
2004-05-04 19:32 ` Juri Linkov
2004-05-05 20:20 ` Richard Stallman
2004-05-06 12:02 ` Juri Linkov
2004-05-01 20:26 ` Stefan Monnier
2004-05-02 16:03 ` Juri Linkov
2004-05-02 16:41 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ad0tyrsu.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).