all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Winston <wbe@psr.com>
Cc: 28439@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#28439: suggestion: support case-independent xref-find-definitions prompt TAB
Date: Wed, 13 Sep 2017 18:30:44 +0300	[thread overview]
Message-ID: <83r2vaobtn.fsf@gnu.org> (raw)
In-Reply-To: <201709122237.v8CMb6w0029533@psr.com> (message from Winston on Tue, 12 Sep 2017 18:37 EDT)

> Date: Tue, 12 Sep 2017 18:37 EDT
> From: Winston <wbe@psr.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Dmitry Gutov <dgutov@yandex.ru>
> 
> 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))))
 
 \f
@@ -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





  parent reply	other threads:[~2017-09-13 15:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 22:37 bug#28439: suggestion: support case-independent xref-find-definitions prompt TAB Winston
2017-09-12 23:24 ` Stephen Berman
2017-09-12 23:31 ` bug#28439: suggestion: support case-independent xref-find-definitions Winston
2017-09-13 15:30 ` Eli Zaretskii [this message]
2017-09-13 23:04   ` bug#28439: suggestion: support case-independent xref-find-definitions prompt TAB Dmitry Gutov
2017-09-14 17:01     ` Eli Zaretskii
2017-09-19  0:55       ` Dmitry Gutov
2017-09-19  4:01         ` Eli Zaretskii
2017-09-14 18:21 ` bug#28439: suggestion: support case-independent xref-find-definitions prompt Winston
2017-09-14 22:05   ` Dmitry Gutov
2017-09-14 22:33 ` bug#28439: suggestion: support case-independent Winston
2017-09-19  0:41   ` Dmitry Gutov
2017-09-27 23:07 ` bug#28439: suggestion: support case-independent xref-find-definitions prompt Winston
2017-09-28 20:47   ` Dmitry Gutov
2020-09-15 15:20     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r2vaobtn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=28439@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=wbe@psr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.