all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* patches for etags and shell-command
@ 2006-01-20 16:29 John Williams
  2006-01-21 19:58 ` Richard M. Stallman
  2006-02-15 18:08 ` Francesco Potorti`
  0 siblings, 2 replies; 7+ messages in thread
From: John Williams @ 2006-01-20 16:29 UTC (permalink / raw)


Hello everyone,

This if my first post to emacs-devel, so feel free to correct my etiquette :)

I have two patches today; the first one changes shell-command so that the 
default interactive argument is the current buffer's filename.  This is inspired 
by vim, where a '%' character in a command expands to the current buffer's filename.

--- simple.el   2006-01-20 09:52:46.000000000 -0600
+++ simple-1.el 2006-01-20 10:08:41.000000000 -0600
@@ -1797,8 +1797,12 @@
  In an interactive call, the variable `shell-command-default-error-buffer'
  specifies the value of ERROR-BUFFER."

-  (interactive (list (read-from-minibuffer "Shell command: "
-                                          nil nil nil 'shell-command-history)
+  (interactive (list (read-from-minibuffer
+                      "Shell command: "
+                      nil nil nil
+                      'shell-command-history
+                      (and (buffer-file-name)
+                           (file-relative-name (buffer-file-name))))
                      current-prefix-arg
                      shell-command-default-error-buffer))
    ;; Look for a handler in case default-directory is a remote file name.

This patch corrects a bug in etags that causes completion to only consider the 
tags in a single TAGS buffer.  With the match tag completion will consider tags 
from all the active TAGS buffers.  (The diff is a bit longer than it really 
needs to be because I inadvertently changed tabs to spaces--I didn't change back 
to tabs because spaces appear to be the preferred from of indentation based on 
emacs's default settings.)

--- etags.el    2006-01-20 09:53:43.000000000 -0600
+++ etags-1.el  2006-01-20 10:14:31.000000000 -0600
@@ -747,28 +747,21 @@
  (defun tags-completion-table ()
    (or tags-completion-table
        (condition-case ()
-         (prog2
-          (message "Making tags completion table for %s..." buffer-file-name)
-          (let ((included (tags-included-tables))
-                (table (funcall tags-completion-table-function)))
-            (save-excursion
-              ;; Iterate over the list of included tables, and combine each
-              ;; included table's completion obarray to the parent obarray.
-              (while included
-                ;; Visit the buffer.
-                (let ((tags-file-name (car included)))
-                  (visit-tags-table-buffer 'same))
-                ;; Recurse in that buffer to compute its completion table.
-                (if (tags-completion-table)
-                    ;; Combine the tables.
-                    (mapatoms (lambda (sym) (intern (symbol-name sym) table))
-                              tags-completion-table))
-                (setq included (cdr included))))
-            (setq tags-completion-table table))
-          (message "Making tags completion table for %s...done"
-                   buffer-file-name))
-       (quit (message "Tags completion table construction aborted.")
-             (setq tags-completion-table nil)))))
+          (let (combined-table)
+            (save-excursion
+              (while (visit-tags-table-buffer (and combined-table t))
+                (let ((included (tags-included-tables))
+                      (table (funcall tags-completion-table-function)))
+                  (if (null combined-table)
+                      (setq combined-table table)
+                    (mapatoms (lambda (sym)
+                                (intern (symbol-name sym) combined-table))
+                              table))
+                  (message "Making tags completion table for %s...done"
+                           buffer-file-name))))
+            (setq tags-completion-table combined-table))
+        (quit (message "Tags completion table construction aborted.")
+              (setq tags-completion-table nil)))))

  ;; Completion function for tags.  Does normal try-completion,
  ;; but builds tags-completion-table on demand.

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <E1F9nTR-0003HU-Ew@fencepost.gnu.org>]

end of thread, other threads:[~2006-02-19 21:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-20 16:29 patches for etags and shell-command John Williams
2006-01-21 19:58 ` Richard M. Stallman
2006-01-21 22:17   ` John Williams
2006-01-22 17:44     ` Richard M. Stallman
2006-01-22  0:38   ` Juri Linkov
2006-02-15 18:08 ` Francesco Potorti`
     [not found] <E1F9nTR-0003HU-Ew@fencepost.gnu.org>
2006-02-19 21:48 ` John Williams

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.