emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/load-relative 5bd5632 1/6: * packages/load-relative/loa


From: Stefan Monnier
Subject: [elpa] externals/load-relative 5bd5632 1/6: * packages/load-relative/load-relative.el (__FILE__): bytecomp-filename problem.
Date: Mon, 30 Nov 2020 18:33:51 -0500 (EST)

branch: externals/load-relative
commit 5bd56327669678c4d40018c633298a4602acf0ba
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * packages/load-relative/load-relative.el (__FILE__): bytecomp-filename 
problem.
    Fix other details mentioned by `checkdoc-current-buffer'.
---
 ChangeLog        |  7 ++++++-
 load-relative.el | 38 ++++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5f20404..ff5aa1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * load-relative.el (__FILE__): Mention the bytecomp-filename problem.
+       Fix other details mentioned by `checkdoc-current-buffer'.
+
 2010-09-30  rocky <rocky@gnu.org>
 
        * .gitignore: git Administrivia.
@@ -9,7 +14,7 @@
 
 2010-09-30  rocky <rocky@gnu.org>
 
-       * .gitignore, COPYING, Makefile.am, README, configure.ac: 
+       * .gitignore, COPYING, Makefile.am, README, configure.ac:
        Administrivia. Add COPYING, update README and .gitignore, bump
        version number.
 
diff --git a/load-relative.el b/load-relative.el
index fe01cb3..dccd3d7 100644
--- a/load-relative.el
+++ b/load-relative.el
@@ -26,12 +26,12 @@
 
 ;; Here we provide functions which facilitate writing multi-file Emacs
 ;; packages and facilitate running from the source tree without having
-;; to "install" code or fiddle with evil `load-path'. See
+;; to "install" code or fiddle with evil `load-path'.  See
 ;; https://github.com/rocky/emacs-load-relative/wiki/NYC-Lisp-talk for
 ;; the the rationale behind this.
 ;;
 ;; The functions we add are relative versions of `load', `require' and
-;; `find-file-no-select' and versions which take list arguments. We also add a
+;; `find-file-no-select' and versions which take list arguments.  We also add a
 ;; `__FILE__' function and a `provide-me' macro.
 
 ;; The latest version of this code is at:
@@ -39,13 +39,13 @@
 
 ;; `__FILE__' returns the file name that that the calling program is
 ;; running.  If you are `eval''ing a buffer then the file name of that
-;; buffer is used. The name was selected to be analogous to the name
+;; buffer is used.  The name was selected to be analogous to the name
 ;; used in C, Perl, Python, and Ruby.
 
 ;; `load-relative' loads an Emacs Lisp file relative to another
-;; (presumably currently running) Emacs Lisp file. For example suppose
+;; (presumably currently running) Emacs Lisp file.  For example suppose
 ;; you have Emacs Lisp files "foo.el" and "bar.el" in the same
-;; directory. To load "bar.el" from inside Emacs lisp file "foo.el":
+;; directory.  To load "bar.el" from inside Emacs Lisp file "foo.el":
 ;;
 ;;     (require 'load-relative)
 ;;     (load-relative "baz")
@@ -70,7 +70,7 @@
 ;; `load_relative'.
 ;;
 ;; Use `require-relative-list' when you have a list of files you want
-;; to `require'. To `require-relative' them all in one shot:
+;; to `require'.  To `require-relative' them all in one shot:
 ;;
 ;;     (require-relative-list '("dbgr-init" "dbgr-fringe"))
 ;;
@@ -83,9 +83,9 @@
 ;; the filename, but I consider that a good thing.
 ;;
 ;; The function `find-file-noselect-relative' provides a way of accessing
-;; resources which are located relative to the currently running Emacs lisp
-;; file. This is probably most useful when running Emacs as a scripting engine
-;; for batch processing or with tests cases. For example, this form will find
+;; resources which are located relative to the currently running Emacs Lisp
+;; file.  This is probably most useful when running Emacs as a scripting engine
+;; for batch processing or with tests cases.  For example, this form will find
 ;; the README file for this package.
 ;;
 ;;     (find-file-noselect-relative "README.md")
@@ -109,9 +109,9 @@
   "Return the string name of file/buffer that is currently begin executed.
 
 The first approach for getting this information is perhaps the
-most pervasive and reliable. But it the most low-level and not
+most pervasive and reliable.  But it the most low-level and not
 part of a public API, so it might change in future
-implementations. This method uses the name that is recorded by
+implementations.  This method uses the name that is recorded by
 readevalloop of `lread.c' as the car of variable
 `current-load-list'.
 
@@ -157,6 +157,7 @@ methods work we will use the file-name value find via
    ;; When byte compiling. FIXME: use a more thorough precondition like
    ;; byte-compile-file is somehwere in the backtrace or that
    ;; bytecomp-filename comes from that routine?
+   ;; FIXME: `bytecomp-filename' doesn't exist any more (since Emacs-24.1).
    ((boundp 'bytecomp-filename) bytecomp-filename)
 
    (t (symbol-file symbol) ;; last resort
@@ -169,7 +170,7 @@ methods work we will use the file-name value find via
 the process of being loaded or eval'd.
 
 
-Define FUNCTION to autoload from FILE. FUNCTION is a symbol.
+Define FUNCTION to autoload from FILE.  FUNCTION is a symbol.
 
 FILE is a string to pass to `load'.
 
@@ -231,7 +232,7 @@ in this buffer."
 the process of being loaded or eval'd.
 
 FILE-OR-LIST is either a string or a list of strings containing
-files that you want to loaded. If SYMBOL is given, the location of
+files that you want to loaded.  If SYMBOL is given, the location of
 of the file of where that was defined (as given by `symbol-file' is used
 if other methods of finding __FILE__ don't work."
 
@@ -246,11 +247,13 @@ if other methods of finding __FILE__ don't work."
   "Expand RELATIVE-FILE relative to the Emacs Lisp code that is in
 the process of being loaded or eval'd.
 
-WARNING: it is best to to run this function before any
+WARNING: it is best to run this function before any
 buffer-setting or buffer changing operations."
   (let ((file (or opt-file (__FILE__) default-directory))
         (prefix))
     (unless file
+      ;; FIXME: Since default-directory should basically never be nil, this
+      ;; should basically never trigger!
       (error "Can't expand __FILE__ here and no file name given"))
     (setq prefix (file-name-directory file))
     (expand-file-name (concat prefix relative-file))))
@@ -258,7 +261,7 @@ buffer-setting or buffer changing operations."
 ;;;###autoload
 (defun require-relative (relative-file &optional opt-file opt-prefix)
   "Run `require' on an Emacs Lisp file relative to the Emacs Lisp code
-that is in the process of being loaded or eval'd. The symbol used in require
+that is in the process of being loaded or eval'd.  The symbol used in require
 is the base file name (without directory or file extension) treated as a
 symbol.
 
@@ -285,14 +288,13 @@ strings, each string being the relative name of file you 
want to run."
 ;;;###autoload
 (defmacro provide-me ( &optional prefix )
   "Call `provide' with the feature's symbol name made from
-source-code's file basename sans extension. For example if you
+source-code's file basename sans extension.  For example if you
 write (provide-me) inside file ~/lisp/foo.el, this is the same as
 writing: (provide \\='foo).
 
 With a prefix, that prefix is prepended to the `provide' So in
 the previous example, if you write (provide-me \"bar-\") this is the
-same as writing (provide \\='bar-foo)
-"
+same as writing (provide \\='bar-foo)."
   `(provide (intern (concat ,prefix (file-name-sans-extension
                                      (file-name-nondirectory (__FILE__)))))))
 



reply via email to

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