From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: History for query replace pairs Date: Sun, 09 Nov 2014 19:11:45 +0200 Organization: JURTA Message-ID: <87mw805mem.fsf@mail.jurta.org> References: <87iojduj9n.fsf@mail.jurta.org> <87k33nyirh.fsf@mail.jurta.org> <87sii0becx.fsf@lifelogs.com> <87ioivx2xk.fsf@mail.jurta.org> <87h9yfaihq.fsf@lifelogs.com> <87zjc6pnpg.fsf@mail.jurta.org> <87r3xhnsjb.fsf@mail.jurta.org> <87zjc2pou7.fsf@mail.jurta.org> <87zjc2fqx2.fsf@lifelogs.com> <83oasiqduw.fsf@gnu.org> <87ioiq7yre.fsf@mail.jurta.org> <83ioiqq6j8.fsf@gnu.org> <87vbmpnw3a.fsf@mail.jurta.org> <83d28wpcy1.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415553572 11478 80.91.229.3 (9 Nov 2014 17:19:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Nov 2014 17:19:32 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 09 18:19:25 2014 Return-path: Envelope-to: ged-emacs-devel@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 1XnW96-0003PI-IY for ged-emacs-devel@m.gmane.org; Sun, 09 Nov 2014 18:19:24 +0100 Original-Received: from localhost ([::1]:39484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnW96-00035B-5p for ged-emacs-devel@m.gmane.org; Sun, 09 Nov 2014 12:19:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnW8a-0002hy-BP for emacs-devel@gnu.org; Sun, 09 Nov 2014 12:19:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnW8R-0006Vn-Kj for emacs-devel@gnu.org; Sun, 09 Nov 2014 12:18:52 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.222.226]:38324 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnW8K-0006VD-Vh; Sun, 09 Nov 2014 12:18:37 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 98525348328E50; Sun, 9 Nov 2014 09:18:34 -0800 (PST) In-Reply-To: <83d28wpcy1.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 09 Nov 2014 18:15:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.163.222.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:176629 Archived-At: >> And of course we can't use the same separator globally, because >> char-displayable-p can return different results in different terminals >> (or even different frames). > > Indeed, this test will need to be done each time the history element > is about to be displayed. This problem is solved by the following patch: === modified file 'lisp/replace.el' --- lisp/replace.el 2014-11-07 23:33:41 +0000 +++ lisp/replace.el 2014-11-09 17:11:01 +0000 @@ -67,11 +67,20 @@ (make-obsolete-variable 'query-replace-i to the minibuffer that reads the string to replace, or invoke replacements from Isearch by using a key sequence like `C-s C-s M-%'." "24.3") -(defvar query-replace-from-to-separator - (propertize "\0" - 'display (propertize " \u2192 " 'face 'minibuffer-prompt) - 'separator t) - "String that separates FROM and TO in the history of replacement pairs.") +(defcustom query-replace-from-to-separator + (propertize + "\0" + 'display (propertize + (if (and + ;; Don't call char-displayable-p while pre-loading replace. + (not (equal (car preloaded-file-list) "replace")) + (char-displayable-p ?\u2192)) " \u2192 " " -> ") + 'face 'minibuffer-prompt) + 'separator t) + "String that separates FROM and TO in the history of replacement pairs." + :group 'matching + :type 'sexp + :version "25.1") (defcustom query-replace-from-history-variable 'query-replace-history "History list to use for the FROM argument of `query-replace' commands. @@ -137,6 +146,7 @@ (defun query-replace-read-from (prompt r wants to replace FROM with TO." (if query-replace-interactive (car (if regexp-flag regexp-search-ring search-ring)) + (custom-reevaluate-setting 'query-replace-from-to-separator) (let* ((history-add-new-input nil) (query-replace-from-to-history (append