[Top][All Lists]

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

Re: dirvars.el 1.3

From: Masatake YAMATO
Subject: Re: dirvars.el 1.3
Date: Tue, 20 Jun 2006 13:56:56 +0900 (JST)

> People on emacs-devel, would you please look at the code
> and see if it is good enough to include?

I think it is quite useful.

How about adding following two functions?

(defun edit-dirvars-file ()
  "Edit dirvars file for the current buffer."
  (let ((dirvars-file (dirvars-find-upwards dirvars-file-name)))
    (if dirvars-file
        (find-file dirvars-file)
      (when (and (interactive-p)
                  (format "Cannot find dirvars file for the current buffer. 
Create %s"
          (let ((dir (read-directory-name "At which directory? ")))
            (find-file (concat (file-name-as-directory dir) 

Further more it is nice if it is possible to reload a dirvars file in
all buffers which share the dirvars fileafter editing the dirvars file.

(defun dirvars-list-buffers (common-dirvars-file)
  "Returns list of buffers which share COMMON-DIRVARS-FILE as dirvars file."
  (setq common-dirvars-file (expand-file-name common-dirvars-file))
  (let (buffers)
    (dolist (buffer (buffer-list) buffers)
      (with-current-buffer buffer
        (when (string= common-dirvars-file (dirvars-find-upwards 
          (setq buffers (cons buffer buffers)))))))

This is for eager emacs lisp programmers.  With this function, for
example, you can filter the output of C-x C-b. Generally a heavy emacs
user loads too many files onto running emacs. So too many files are
listed on C-x C-b buffers. In the case that the user wants to switch
to the buffer associated with the file under the same sub directory tree, 
list all buffers are too enough. dirvars-list-buffers can return the
the buffer associated with the file under the same sub directory tree
if dirvars file exists.

Masatake YAMATO

reply via email to

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