[Top][All Lists]

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

Re: [h-e-w] c++ editing , variable name completion

From: Richard Y. Kim
Subject: Re: [h-e-w] c++ editing , variable name completion
Date: Fri, 26 Jul 2002 22:05:44 -0700

I've been using tags based completion for many years.

The following is from my own etags.el which I've been using on ntemacs
for several years.  I grabbed etags.el from an early 19.X Xemacs and
made it work with ntemacs 19.xx.  I've been using it since.  It works
fine on ntemacs 20.x and 21.x as well.  Note that GNU Emacs and GNU
XEmacs both come with etags.el which are quite different.

Upon quick review of the code below, it seemed like it would work
without needing anything else from my own etags.el, so I include it below.

Another note, oo-browser <> also comes with
br-complete-symbol command which works similar to tag-complete-symbol below.

See <>
for further comments on oo-browser, ebrowse, etc.

(defun tag-complete-symbol ()
  "The function used to do tags-completion (using 'tag-completion-predicate)."
  (let* ((buffer-tag-table-list (buffer-tag-table-symbol-list))
    (complete-symbol-xemacs-etags tag-completion-table 

(defun complete-symbol-xemacs-etags (&optional table predicate prettify)
  (let* ((end (point))
         (beg (save-excursion
                (backward-sexp 1)
                (while (= (char-syntax (following-char)) ?\')
                  (forward-char 1))
         (pattern (buffer-substring beg end))
         (table (or table obarray))
         (completion (try-completion pattern table predicate)))
    (cond ((eq completion t))
          ((null completion)
           (message "Can't find completion for \"%s\"" pattern)
          ((not (string-equal pattern completion))
           (delete-region beg end)
           (insert completion))
           (message "Making completion list...")
           (let ((list (all-completions pattern table predicate)))
             (if prettify
                 (setq list (funcall prettify list)))
             (with-output-to-temp-buffer "*Help*"
               (display-completion-list list)))
           (message "Making completion list...%s" "done")))))

>>>>> "DV" == David Vanderschel <address@hidden> writes:
    DV> Besides dabbrev, there is another completion mechanism
    DV> which has not been mentioned here and which I believe
    DV> is more along the lines of what Paul and Eric are
    DV> working on.  Look up the "Symbol Completion" node in
    DV> emacs info.  This mechanism is based on tags (which
    DV> are derived syntactically depending on the programming
    DV> language).
    DV> Yet another unmentioned completion mechanism for
    DV> regular text is ispell-complete-word.  (Though it does
    DV> spell check OK, my own emacs installation of ispell
    DV> does not yet seem to be configured correctly to
    DV> support this.)
    DV> Regards,
    DV>   David V.

reply via email to

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