X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b90caf50d04d2c51742054bb6b0e836f6d425203..aad4679e7ddbc55a998a4b1111b0cc8c5d3a359f:/lisp/cedet/cedet-idutils.el diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el index 3635f7fc8a..44c325b78c 100644 --- a/lisp/cedet/cedet-idutils.el +++ b/lisp/cedet/cedet-idutils.el @@ -1,10 +1,11 @@ ;;; cedet-idutils.el --- ID Utils support for CEDET. -;;; Copyright (C) 2009 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Version: 0.2 ;; Keywords: OO, lisp +;; Package: cedet ;; This file is part of GNU Emacs. @@ -44,7 +45,7 @@ :group 'cedet) (defun cedet-idutils-search (searchtext texttype type scope) - "Perform a search with IDUtils, return the created buffer. + "Perform a search with ID Utils, return the created buffer. SEARCHTEXT is text to find. TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, 'tagregexp, or 'tagcompletions. @@ -82,8 +83,7 @@ Return the created buffer with with program output." (let ((b (get-buffer-create "*CEDET fnid*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-idutils-file-command @@ -97,8 +97,7 @@ Return the created buffer with with program output." (let ((b (get-buffer-create "*CEDET lid*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-idutils-token-command @@ -109,17 +108,16 @@ Return the created buffer with with program output." ;;; UTIL CALLS ;; (defun cedet-idutils-expand-filename (filename) - "Expand the FILENAME with IDUtils. + "Expand the FILENAME with ID Utils. Return a filename relative to the default directory." (interactive "sFile: ") - (let ((ans (save-excursion - (set-buffer (cedet-idutils-fnid-call (list filename))) + (let ((ans (with-current-buffer (cedet-idutils-fnid-call (list filename)) (goto-char (point-min)) (if (looking-at "[^ \n]*fnid: ") (error "ID Utils not available") (split-string (buffer-string) "\n" t))))) (setq ans (mapcar 'expand-file-name ans)) - (when (interactive-p) + (when (called-interactively-p 'interactive) (if ans (if (= (length ans) 1) (message "%s" (car ans)) @@ -129,7 +127,7 @@ Return a filename relative to the default directory." ans)) (defun cedet-idutils-support-for-directory (&optional dir) - "Return non-nil if IDUtils has a support file for DIR. + "Return non-nil if ID Utils has a support file for DIR. If DIR is not supplied, use the current default directory. This works by running lid on a bogus symbol, and looking for the error code." @@ -157,25 +155,25 @@ return nil." (rev nil)) (if (not b) (progn - (when (interactive-p) + (when (called-interactively-p 'interactive) (message "ID Utils not found.")) nil) - (save-excursion - (set-buffer b) + (with-current-buffer b (goto-char (point-min)) (re-search-forward "fnid - \\([0-9.]+\\)" nil t) (setq rev (match-string 1)) (if (inversion-check-version rev nil cedet-idutils-min-version) (if noerror nil - (error "Version of ID Utis is %s. Need at least %s" + (error "Version of ID Utils is %s. Need at least %s" rev cedet-idutils-min-version)) ;; Else, return TRUE, as in good enough. - (when (interactive-p) + (when (called-interactively-p 'interactive) (message "ID Utils %s - Good enough for CEDET." rev)) t))))) (provide 'cedet-idutils) +;; arch-tag: 663ca082-5b3d-4384-8710-cc74f990b501 ;;; cedet-idutils.el ends here