From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Williams Newsgroups: gmane.emacs.devel Subject: patches for etags and shell-command Date: Fri, 20 Jan 2006 10:29:40 -0600 Message-ID: <43D10FF4.8030202@pobox.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1137792537 11527 80.91.229.2 (20 Jan 2006 21:28:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 21:28:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 20 22:28:54 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F03oJ-0003fZ-2y for ged-emacs-devel@m.gmane.org; Fri, 20 Jan 2006 22:28:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F03qo-0005uv-3s for ged-emacs-devel@m.gmane.org; Fri, 20 Jan 2006 16:31:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F006L-0004Ow-G5 for emacs-devel@gnu.org; Fri, 20 Jan 2006 12:31:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ezznh-00073j-Mg for emacs-devel@gnu.org; Fri, 20 Jan 2006 12:11:52 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EzzCp-000824-3j for emacs-devel@gnu.org; Fri, 20 Jan 2006 11:33:43 -0500 Original-Received: from [216.84.45.195] (helo=www.languagecomputer.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EzzH3-0003q7-MS for emacs-devel@gnu.org; Fri, 20 Jan 2006 11:38:05 -0500 Original-Received: from [192.168.1.37] (unknown [216.84.45.194]) by www.languagecomputer.com (Postfix) with ESMTP id 49A952B95E for ; Fri, 20 Jan 2006 10:38:01 -0600 (CST) User-Agent: Thunderbird 1.5 (X11/20051201) Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49331 Archived-At: 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.