From: Juri Linkov <juri@jurta.org>
To: martin rudalics <rudalics@gmx.at>
Cc: Eli Barzilay <eli@barzilay.org>, 4136@emacsbugs.donarmstrong.com
Subject: bug#4136: 23.1; delete-pair
Date: Wed, 19 Aug 2009 03:48:09 +0300 [thread overview]
Message-ID: <871vn8r2c2.fsf@mail.jurta.org> (raw)
In-Reply-To: <4A8A549E.20605@gmx.at> (martin rudalics's message of "Tue, 18 Aug 2009 09:13:34 +0200")
>> We are in violent agreement. I didn't claim that `delete-pair'
>> shouldn't check `insert-pair-alist'. On the contrary, I think
>> `delete-pair' should verify if the character pair starting at the
>> current point is part of a pair according to `insert-pair-alist'.
>> "At the current point" - that's my point. It shouldn't try
>> finding the opening character somewhere else. So in your original
>> test case it should throw an error when the cursor is on some
>> whitespace that precedes an expression.
>
> Ne hlebom jedinnym. Why can't we be generous and provide something like
> the attached?
>
> martin
> *** emacs-lisp/lisp.el.~1.102.~ 2009-07-27 08:10:54.124527300 +0200
> --- emacs-lisp/lisp.el 2009-08-18 08:52:42.734375000 +0200
> ***************
> *** 527,537 ****
> (interactive "P")
> (insert-pair arg ?\( ?\)))
>
> ! (defun delete-pair ()
> ! "Delete a pair of characters enclosing the sexp that follows point."
> ! (interactive)
> ! (save-excursion (forward-sexp 1) (delete-char -1))
> ! (delete-char 1))
>
> (defun raise-sexp (&optional arg)
> "Raise ARG sexps higher up the tree."
> --- 527,566 ----
> (interactive "P")
> (insert-pair arg ?\( ?\)))
>
> ! (defun delete-pair (&optional arg)
> ! "Delete a pair of characters enclosing ARG sexps that follow point.
> ! A negative ARG deletes a pair around the preceding ARG sexps instead."
> ! (interactive "P")
> !
> ! (if arg
> ! (setq arg (prefix-numeric-value arg))
> ! (setq arg 1))
> !
> ! (if (< arg 0)
> ! (save-excursion
> ! (skip-chars-backward " \t")
> ! (save-excursion
> ! (let ((close-char (char-before)))
> ! (forward-sexp arg)
> ! (unless (member (list (char-after) close-char)
> ! (mapcar (lambda (p)
> ! (if (= (length p) 3) (cdr p) p))
> ! insert-pair-alist))
> ! (error "Not after matching pair"))
> ! (delete-char 1)))
> ! (delete-char -1))
> ! (save-excursion
> ! (skip-chars-forward " \t")
> ! (save-excursion
> ! (let ((open-char (char-after)))
> ! (forward-sexp arg)
> ! (unless (member (list open-char (char-before))
> ! (mapcar (lambda (p)
> ! (if (= (length p) 3) (cdr p) p))
> ! insert-pair-alist))
> ! (error "Not before matching pair"))
> ! (delete-char -1)))
> ! (delete-char 1))))
>
> (defun raise-sexp (&optional arg)
> "Raise ARG sexps higher up the tree."
Hmm, I think this makes sense.
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2009-08-19 0:48 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 6:22 bug#4136: 23.1; delete-pair Eli Barzilay
2009-08-13 9:53 ` martin rudalics
2009-08-13 23:29 ` Juri Linkov
2009-08-14 1:18 ` Eli Barzilay
2009-08-14 15:50 ` Stefan Monnier
2009-08-14 22:45 ` Juri Linkov
2009-08-15 1:46 ` Eli Barzilay
2009-08-15 23:06 ` Juri Linkov
2009-08-16 0:00 ` Eli Barzilay
2009-08-17 0:46 ` Juri Linkov
2009-08-17 3:13 ` Eli Barzilay
2009-08-17 21:17 ` Juri Linkov
2009-08-18 7:13 ` martin rudalics
2009-08-19 0:48 ` Juri Linkov [this message]
2020-09-14 14:08 ` Lars Ingebrigtsen
2020-09-14 19:12 ` Juri Linkov
2020-09-15 12:27 ` Lars Ingebrigtsen
2020-09-15 18:07 ` Juri Linkov
2020-09-17 14:45 ` Lars Ingebrigtsen
2020-09-18 8:35 ` Juri Linkov
2020-09-18 10:59 ` Lars Ingebrigtsen
2020-09-21 19:12 ` Juri Linkov
2020-09-22 14:45 ` Lars Ingebrigtsen
2020-09-22 18:18 ` Juri Linkov
2020-09-23 13:15 ` Lars Ingebrigtsen
2020-11-12 20:21 ` Juri Linkov
2020-11-12 21:16 ` Basil L. Contovounesios
2020-11-13 8:29 ` Juri Linkov
2020-11-16 20:55 ` Juri Linkov
2020-11-16 21:37 ` Drew Adams
2009-08-16 10:27 ` martin rudalics
2009-08-18 3:10 ` Stefan Monnier
2009-08-19 0:47 ` Juri Linkov
2009-08-15 10:11 ` martin rudalics
2009-08-14 7:17 ` martin rudalics
2009-08-14 22:45 ` Juri Linkov
2009-08-15 10:11 ` martin rudalics
2009-08-15 23:03 ` Juri Linkov
2009-08-16 10:27 ` martin rudalics
2009-08-13 23:28 ` Juri Linkov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871vn8r2c2.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=4136@emacsbugs.donarmstrong.com \
--cc=eli@barzilay.org \
--cc=rudalics@gmx.at \
/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 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.