GNU bug report logs - #4136
23.1; delete-pair

Previous Next

Package: emacs;

Reported by: Eli Barzilay <eli <at> barzilay.org>

Date: Thu, 13 Aug 2009 06:30:04 UTC

Severity: normal

Tags: fixed, moreinfo

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Barzilay <eli <at> barzilay.org>, 4136 <at> debbugs.gnu.org
Subject: bug#4136: 23.1; delete-pair
Date: Wed, 19 Aug 2009 03:48:09 +0300
>> 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/



This bug report was last modified 4 years and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.