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: Mon, 10 Nov 2014 01:12:08 +0200 Organization: JURTA Message-ID: <8761eovuif.fsf@mail.jurta.org> References: <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> <87mw805mem.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415574888 2723 80.91.229.3 (9 Nov 2014 23:14:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Nov 2014 23:14:48 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 10 00:14:41 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 1Xnbgv-0006Uq-3o for ged-emacs-devel@m.gmane.org; Mon, 10 Nov 2014 00:14:41 +0100 Original-Received: from localhost ([::1]:40335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnbgu-0007AO-MU for ged-emacs-devel@m.gmane.org; Sun, 09 Nov 2014 18:14:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnbgb-000796-Lo for emacs-devel@gnu.org; Sun, 09 Nov 2014 18:14:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnbgV-0000mi-Ai for emacs-devel@gnu.org; Sun, 09 Nov 2014 18:14:21 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.222.226]:33847 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnbgM-0000lr-O4; Sun, 09 Nov 2014 18:14:06 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id D670C348328E73; Sun, 9 Nov 2014 15:14:05 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sun, 09 Nov 2014 17:14:08 -0500") 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:176654 Archived-At: > The (not (equal (car preloaded-file-list) "replace")) test makes > no sense. Why don't we want to call char-displayable-p while > pre-loading replace? Shouldn't we instead test (fboundp 'char-displayable-p) > or simply wrap the code in ignore-errors (if the problem is that > char-displayable-p fails when run without a real frame at hand, which > might also happen in daemon mode)? I already tried (fboundp 'char-displayable-p) earlier but it returns t while pre-loading because the problem was caused by an attempt to autoload char-displayable-p. Now I tried ignore-errors, and there are no problems with it: === modified file 'lisp/replace.el' --- lisp/replace.el 2014-11-07 23:33:41 +0000 +++ lisp/replace.el 2014-11-09 22:58:25 +0000 @@ -67,11 +67,16 @@ (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 + (or (ignore-errors + (if (char-displayable-p ?\u2192) " \u2192 " " -> ")) + " -> ") + 'face 'minibuffer-prompt) + "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,19 +142,25 @@ (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) + (separator + (when query-replace-from-to-separator + (propertize "\0" + 'display query-replace-from-to-separator + 'separator t))) (query-replace-from-to-history (append - (when query-replace-from-to-separator + (when separator (mapcar (lambda (from-to) (concat (query-replace-descr (car from-to)) - query-replace-from-to-separator + separator (query-replace-descr (cdr from-to)))) query-replace-defaults)) (symbol-value query-replace-from-history-variable))) (minibuffer-allow-text-properties t) ; separator uses text-properties (prompt - (if (and query-replace-defaults query-replace-from-to-separator) + (if (and query-replace-defaults separator) (format "%s (default %s): " prompt (car query-replace-from-to-history)) (format "%s: " prompt))) (from @@ -166,7 +177,7 @@ (defun query-replace-read-from (prompt r (cons (caar query-replace-defaults) (query-replace-compile-replacement (cdar query-replace-defaults) regexp-flag)) - (let* ((to (if (and (string-match query-replace-from-to-separator from) + (let* ((to (if (and (string-match separator from) (get-text-property (match-beginning 0) 'separator from)) (query-replace-compile-replacement (substring-no-properties from (match-end 0)) regexp-flag)))