:type '(choice (const :tag "Case-sensitive" nil)
(const :tag "Case-insensitive" t)
(other :tag "Use default" default))
- :version "21.1")
+ :version "21.1"
+ :safe 'symbolp)
;;;###autoload
;; Use `visit-tags-table-buffer' to cycle through tags tables in this list.
"Using tags, return a completion table for the text around point.
If no tags table is loaded, do nothing and return nil."
(when (or tags-table-list tags-file-name)
- (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
- tags-case-fold-search
- case-fold-search))
+ (let ((completion-ignore-case (find-tag--completion-ignore-case))
(pattern (find-tag--default))
beg)
(when pattern
\f
(defun find-tag-tag (string)
"Read a tag name, with defaulting and completion."
- (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
- tags-case-fold-search
- case-fold-search))
+ (let* ((completion-ignore-case (find-tag--completion-ignore-case))
(default (find-tag--default))
(spec (completing-read (if default
(format "%s (default %s): "
(or default (user-error "There is no default tag"))
spec)))
+(defun find-tag--completion-ignore-case ()
+ (if (memq tags-case-fold-search '(t nil))
+ tags-case-fold-search
+ case-fold-search))
+
(defun find-tag--default ()
(funcall (or find-tag-default-function
(get major-mode 'find-tag-default-function)
(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql etags)))
(tags-lazy-completion-table))
+(cl-defmethod xref-backend-identifier-completion-ignore-case ((_backend (eql etags)))
+ (find-tag--completion-ignore-case))
+
(cl-defmethod xref-backend-definitions ((_backend (eql etags)) symbol)
(etags--xref-find-definitions symbol))
(first-time t)
(search-fun (if regexp? #'re-search-forward #'search-forward))
(marks (make-hash-table :test 'equal))
- (case-fold-search (if (memq tags-case-fold-search '(nil t))
- tags-case-fold-search
- case-fold-search))
+ (case-fold-search (find-tag--completion-ignore-case))
(cbuf (current-buffer)))
(save-excursion
(while (visit-tags-table-buffer (not first-time) cbuf)
(cl-defgeneric xref-backend-identifier-completion-table (backend)
"Return the completion table for identifiers.")
+(cl-defgeneric xref-backend-identifier-completion-ignore-case (_backend)
+ "Return t if case is not significant in identifier completion."
+ completion-ignore-case)
+
\f
;;; misc utilities
(defun xref--alistify (list key test)
(defun xref--read-identifier (prompt)
"Return the identifier at point or read it from the minibuffer."
(let* ((backend (xref-find-backend))
- (def (xref-backend-identifier-at-point backend)))
+ (def (xref-backend-identifier-at-point backend))
+ (completion-ignore-case
+ (xref-backend-identifier-completion-ignore-case backend)))
(cond ((or current-prefix-arg
(not def)
(xref--prompt-p this-command))