emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master fecd155: * lisp/emacs-lisp/package.el: Skip space a


From: Artur Malabarba
Subject: [Emacs-diffs] master fecd155: * lisp/emacs-lisp/package.el: Skip space and comments in init file
Date: Tue, 28 Apr 2015 10:09:11 +0000

branch: master
commit fecd155703ee2e546bee1749e9e0fb97bab357eb
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/emacs-lisp/package.el: Skip space and comments in init file
    
    (package--ensure-init-file): Insert snippet at first
    non-whitespace non-comments line.  Respects local-vars at the top
    of the file.
---
 lisp/emacs-lisp/package.el |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 81e0ee9..bb9a3bb 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1813,6 +1813,7 @@ using `package-compute-transaction'."
                       (widen)
                       (goto-char (point-min))
                       (search-forward "(package-initialize)" nil 'noerror))))
+              ;; Don't visit the file if we don't have to.
               (with-temp-buffer
                 (insert-file-contents user-init-file)
                 (goto-char (point-min))
@@ -1825,7 +1826,11 @@ using `package-compute-transaction'."
             (save-restriction
               (widen)
               (goto-char (point-min))
+              (while (and (looking-at-p "[[:blank:]]*\\(;\\|$\\)")
+                          (not (eobp)))
+                (forward-line 1))
               (insert
+               "\n"
                ";; Added by Package.el.  This must come before configurations 
of\n"
                ";; installed packages.  Don't delete this line.  If you don't 
want it,\n"
                ";; just comment it out by adding a semicolon to the start of 
the line.\n"



reply via email to

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