[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG 20703 further evidence

From: Dmitry Gutov
Subject: Re: BUG 20703 further evidence
Date: Thu, 14 Jan 2016 00:50:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0

On 01/14/2016 12:36 AM, Sam Halliday wrote:

The approach that sounds most sensible for my use case sounds like just 
excluding that one file from indexing, because I can do that from my .ctags. I 
actually hadn't thought of it until you mentioned it!

I've suggested it before, in a comment to the bug in question:

I was thinking along the lines of a function that deletes all the long lines 
from a TAGS file, part of a validation / cleanup phase. If you have a recipe in 
mind for that, it would be pretty useful.

That code still has to be written. Maybe after 25.1?

Could you please copy out your proposed changes in full? I won't be applying 
them against their sources, I'll just put them in my scratch and execute in the 
running instance.

Try replacing these definitions:

(defvar etags--table-line-limit 500)

(defun etags-tags-completion-table ()   ; Doc string?
  (let (table
          (format "Making tags completion table for %s..." buffer-file-name)
          (point-min) (point-max))))
      (goto-char (point-min))
      ;; This regexp matches an explicit tag name or the place where
      ;; it would start.
      (while (not (eobp))
        (if (not (re-search-forward
                  "[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?"
                  ;; Avoid lines that are too long (bug#20703).
                  (+ (point) etags--table-line-limit) t))
            (forward-line 1)
          (push (prog1 (if (match-beginning 1)
                           ;; There is an explicit tag name.
                           (buffer-substring (match-beginning 1) (match-end 1))
                         ;; No explicit tag name.  Backtrack a little,
                         ;; and look for the implicit one.
                         (goto-char (match-beginning 0))
                         (skip-chars-backward "^\f\t\n\r()=,; ")
                             (buffer-substring (point) (match-beginning 0))
                           (goto-char (match-end 0))))
                  (progress-reporter-update progress-reporter (point)))

(defun tags-completion-table ()
  "Build `tags-completion-table' on demand.
The tags included in the completion table are those in the current
tags table and its (recursively) included tags tables."
  (or tags-completion-table
      ;; No cached value for this buffer.
      (condition-case ()
          (let (current-table combined-table)
            (message "Making tags completion table for %s..." buffer-file-name)
              ;; Iterate over the current list of tags tables.
              (while (visit-tags-table-buffer (and combined-table t))
                ;; Find possible completions in this table.
                (setq current-table (funcall tags-completion-table-function))
                ;; Merge this buffer's completions into the combined table.
                (if combined-table
                     (lambda (sym) (intern (symbol-name sym) combined-table))
                  (setq combined-table current-table))))
            (message "Making tags completion table for %s...done"
            ;; Cache the result in a buffer-local variable.
            (setq tags-completion-table combined-table))
        (quit (message "Tags completion table construction aborted.")
              (setq tags-completion-table nil)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]