[Top][All Lists]

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

[elpa] master 933969e 05/14: Merge pull request #3 from phillord/feature

From: Rocky Bernstein
Subject: [elpa] master 933969e 05/14: Merge pull request #3 from phillord/feature/find-file-relative
Date: Wed, 25 Feb 2015 01:24:38 +0000

branch: master
commit 933969eebdaeb06c2ba85c74b00af3a445ae7092
Merge: 3fa56d7 267e9c3
Author: R. Bernstein <address@hidden>
Commit: R. Bernstein <address@hidden>

    Merge pull request #3 from phillord/feature/find-file-relative
    New functions for opening files.
 load-relative.el |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/load-relative.el b/load-relative.el
index 16661bc..6fac96f 100644
--- a/load-relative.el
+++ b/load-relative.el
@@ -180,6 +180,30 @@ finding __FILE__ don't work."
+(defun find-file-noselect-relative (filename &optional nowarn rawfile 
+  "Read relative FILENAME into a buffer and return the buffer.
+If a buffer exists visiting FILENAME, return that one, but
+verify that the file has not changed since visited or saved.
+The buffer is not selected, just returned to the caller.
+Optional second arg NOWARN non-nil means suppress any warning messages.
+Optional third arg RAWFILE non-nil means the file is read literally.
+Optional fourth arg WILDCARDS non-nil means do wildcard processing
+and visit all the matching files.  When wildcards are actually
+used and expanded, return a list of buffers that are visiting
+the various files."
+  (find-file-noselect (relative-expand-file-name filename)
+                      nowarn rawfile wildcards))
+(defmacro with-relative-file (file &rest body)
+  "Read relative FILE into a temporary buffer and evaluated BODY
+in this buffer."
+  (declare (indent 1) (debug t))
+  `(with-current-buffer
+       (find-file-noselect-relative ,file)
+     ,@body))
 (defun load-relative (file-or-list &optional symbol)
   "Load an Emacs Lisp file relative to Emacs Lisp code that is in
 the process of being loaded or eval'd.

reply via email to

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