From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#14742: 24.3.50; enhancement request: be able to prepend stuff from buffer when search backward Date: Sun, 30 Jun 2013 00:50:36 +0300 Organization: JURTA Message-ID: <87haggoc6r.fsf@mail.jurta.org> References: <4b9029ca-1775-482f-ba9a-46a891be7405@default> <87sj01c3n2.fsf@mail.jurta.org> <7518b30b-63d2-40ea-956f-a504f40c4cfd@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372543630 7514 80.91.229.3 (29 Jun 2013 22:07:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Jun 2013 22:07:10 +0000 (UTC) Cc: 14742@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 30 00:07:11 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ut3IT-00032f-I1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Jun 2013 00:07:09 +0200 Original-Received: from localhost ([::1]:47046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut3IT-0007e4-30 for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Jun 2013 18:07:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut3IO-0007bT-UI for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2013 18:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ut3IM-000589-TV for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2013 18:07:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut3IM-000585-Qa for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2013 18:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Ut3IM-0006iG-BO for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2013 18:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Jun 2013 22:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14742 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14742-submit@debbugs.gnu.org id=B14742.137254360725753 (code B ref 14742); Sat, 29 Jun 2013 22:07:02 +0000 Original-Received: (at 14742) by debbugs.gnu.org; 29 Jun 2013 22:06:47 +0000 Original-Received: from localhost ([127.0.0.1]:48572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ut3I7-0006hG-AJ for submit@debbugs.gnu.org; Sat, 29 Jun 2013 18:06:47 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:40582 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ut3I4-0006gt-55 for 14742@debbugs.gnu.org; Sat, 29 Jun 2013 18:06:45 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7B8B1258B9E915; Sat, 29 Jun 2013 15:06:42 -0700 (PDT) In-Reply-To: <7518b30b-63d2-40ea-956f-a504f40c4cfd@default> (Drew Adams's message of "Fri, 28 Jun 2013 15:00:47 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75726 Archived-At: >> and since then I have not had problems with it. So what could >> be done is to move this code from `isearch-other-meta-char' >> to `isearch-yank-string' and `isearch-del-char' for more >> general functionality by adding a new argument `BACK' to them >> (or could you propose a better name for the argument). > > I take your word for it wrt the implementation. After I see it, > I might have a suggestion wrt the name (maybe BACKWARD, as that > seems to be the term used in our search names). It's easy to find a name for the new arg of `isearch-yank-string'. By default, it appends a string to the end of the search string, so a new arg for opposite meaning could have the name `prepend' to prepend a string to the beginning of the search string. But what could be a name for the new arg of `isearch-del-char'? By default, it deletes a substring from the end of the search string. And with a non-nil new arg it will delete a substring from the beginning of the search string. What about the name `behead' suggested in http://english.stackexchange.com/questions/111382/what-are-the-antonyms-of-append-and-prepend === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-06-13 22:08:45 +0000 +++ lisp/isearch.el 2013-06-29 21:50:03 +0000 @@ -1839,7 +1839,7 @@ (defun isearch-delete-char () (isearch-pop-state)) (isearch-update)) -(defun isearch-del-char (&optional arg) +(defun isearch-del-char (&optional arg behead) "Delete character from end of search string and search again. Unlike `isearch-delete-char', it only deletes the last character, but doesn't cancel the effect of other isearch command. @@ -1847,9 +1847,13 @@ (defun isearch-del-char (&optional arg) (interactive "p") (if (= 0 (length isearch-string)) (ding) - (setq isearch-string (substring isearch-string 0 - (- (min (or arg 1) - (length isearch-string)))) + (setq isearch-string (if behead + (substring isearch-string + (min (or arg 1) + (length isearch-string))) + (substring isearch-string 0 + (- (min (or arg 1) + (length isearch-string))))) isearch-message (mapconcat 'isearch-text-char-description isearch-string ""))) ;; Use the isearch-other-end as new starting point to be able @@ -1858,17 +1862,23 @@ (defun isearch-del-char (&optional arg) (isearch-push-state) (isearch-update))) -(defun isearch-yank-string (string) +(defun isearch-yank-string (string &optional prepend) "Pull STRING into search string." ;; Downcase the string if not supposed to case-fold yanked strings. (if (and isearch-case-fold-search (eq 'not-yanks search-upper-case)) (setq string (downcase string))) (if isearch-regexp (setq string (regexp-quote string))) - (setq isearch-string (concat isearch-string string) + (setq isearch-string (if prepend + (concat string isearch-string) + (concat isearch-string string)) isearch-message (concat isearch-message (mapconcat 'isearch-text-char-description