From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28439: suggestion: support case-independent xref-find-definitions prompt TAB Date: Wed, 13 Sep 2017 18:30:44 +0300 Message-ID: <83r2vaobtn.fsf@gnu.org> References: <201709122237.v8CMb6w0029533@psr.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1505316792 21343 195.159.176.226 (13 Sep 2017 15:33:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2017 15:33:12 +0000 (UTC) Cc: 28439@debbugs.gnu.org, dgutov@yandex.ru To: Winston Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 13 17:33:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds9f0-0005NS-Ix for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Sep 2017 17:33:06 +0200 Original-Received: from localhost ([::1]:43088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds9f7-0000xH-VP for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Sep 2017 11:33:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds9e2-0000E1-E1 for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:32:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds9dy-0004Zi-7X for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:32:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ds9dy-0004ZT-34 for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ds9dx-00008d-Tr for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2017 15:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28439 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, dgutov@yandex.ru Original-Received: via spool by submit@debbugs.gnu.org id=B.1505316682476 (code B ref -1); Wed, 13 Sep 2017 15:32:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Sep 2017 15:31:22 +0000 Original-Received: from localhost ([127.0.0.1]:38506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds9dJ-00007b-OW for submit@debbugs.gnu.org; Wed, 13 Sep 2017 11:31:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds9dI-00007P-IB for submit@debbugs.gnu.org; Wed, 13 Sep 2017 11:31:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds9dC-0003y0-0p for submit@debbugs.gnu.org; Wed, 13 Sep 2017 11:31:15 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ds9dB-0003xw-UB for submit@debbugs.gnu.org; Wed, 13 Sep 2017 11:31:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds9d9-0007oE-9g for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:31:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds9d4-0003o2-Ti for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 11:31:11 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds9co-0003aF-6s; Wed, 13 Sep 2017 11:30:50 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3611 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ds9cm-0003S8-Vk; Wed, 13 Sep 2017 11:30:49 -0400 In-reply-to: <201709122237.v8CMb6w0029533@psr.com> (message from Winston on Tue, 12 Sep 2017 18:37 EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:136886 Archived-At: > Date: Tue, 12 Sep 2017 18:37 EDT > From: Winston > Cc: Eli Zaretskii , Dmitry Gutov > > xref-find-definitions UI suggestion: > > Since xref-find-definitions is willing to match names typed in all > lower case to mixed case names, TAB (show alternatives) should, too. > If there's not already a way to make TAB do so, then a way should be > added. Dmitry, how about the patch below? --- lisp/progmodes/xref.el~0 2017-06-01 07:00:20.000000000 +0300 +++ lisp/progmodes/xref.el 2017-09-13 07:30:19.779611200 +0300 @@ -762,22 +762,25 @@ (not (memq command (cdr xref-prompt-for-identifier))) (memq command xref-prompt-for-identifier)))) -(defun xref--read-identifier (prompt) - "Return the identifier at point or read it from the minibuffer." +(defun xref--read-identifier (prompt &optional caseless) + "Return the identifier at point or read it from the minibuffer. +Optional argument CASELESS means ignore letter-case when completing +on user input." (let* ((backend (xref-find-backend)) (id (xref-backend-identifier-at-point backend))) (cond ((or current-prefix-arg (not id) (xref--prompt-p this-command)) - (completing-read (if id - (format "%s (default %s): " - (substring prompt 0 (string-match - "[ :]+\\'" prompt)) - id) - prompt) - (xref-backend-identifier-completion-table backend) - nil nil nil - 'xref--read-identifier-history id)) + (let ((completion-ignore-case caseless)) + (completing-read (if id + (format "%s (default %s): " + (substring prompt 0 (string-match + "[ :]+\\'" prompt)) + id) + prompt) + (xref-backend-identifier-completion-table backend) + nil nil nil + 'xref--read-identifier-history id))) (t id)))) @@ -804,19 +807,19 @@ definition for IDENTIFIER, display it in the selected window. Otherwise, display the list of the possible definitions in a buffer where the user can select from the list." - (interactive (list (xref--read-identifier "Find definitions of: "))) + (interactive (list (xref--read-identifier "Find definitions of: " t))) (xref--find-definitions identifier nil)) ;;;###autoload (defun xref-find-definitions-other-window (identifier) "Like `xref-find-definitions' but switch to the other window." - (interactive (list (xref--read-identifier "Find definitions of: "))) + (interactive (list (xref--read-identifier "Find definitions of: " t))) (xref--find-definitions identifier 'window)) ;;;###autoload (defun xref-find-definitions-other-frame (identifier) "Like `xref-find-definitions' but switch to the other frame." - (interactive (list (xref--read-identifier "Find definitions of: "))) + (interactive (list (xref--read-identifier "Find definitions of: " t))) (xref--find-definitions identifier 'frame)) ;;;###autoload