bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#28685: 25.3; wrong handling ~/.cpp.el


From: Masatake YAMATO
Subject: bug#28685: 25.3; wrong handling ~/.cpp.el
Date: Tue, 17 Oct 2017 19:23:03 +0900 (JST)

On Sat, 14 Oct 2017 18:11:06 -0400, Glenn Morris <rgm@gnu.org> wrote:
> Eli Zaretskii wrote:
> 
>>> E.g. this entry from NEWS.24:
>>> 
>>> ** More packages look for ~/.emacs.d/<foo> additionally to ~/.<foo>.
>>
>> I'm okay with looking in both places.
> 
> This is what locate-user-emacs-file is for.

How about following extra patch?
Ideally, ~/.emacs.d/.cpp.el should be ~/.emacs.d/cpp.el.
However, I cannot find good way to implement it.

commit 765dfed4bd1ea1a3b6d9b51383fa0ec745479cce (HEAD -> cpp-highlight-check)
Author: Masatake YAMATO <yamato@redhat.com>
Date:   Tue Oct 17 19:20:38 2017 +0900

    Put .cpp.el to ~/.emacs.d if possible
    
    *lisp/progmodes/cpp.el (cpp-edit-load): Use locate-user-emacs-file
    instead of specifying "~/"
    (cpp-edit-save): Ditto.

diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 3a7dab72b4..0a68a0cf2c 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -576,8 +576,8 @@ cpp-edit-load
         nil)
        ((file-readable-p cpp-config-file)
         (load-file cpp-config-file))
-       ((file-readable-p (concat "~/" cpp-config-file))
-        (load-file (concat "~/" cpp-config-file))))
+       ((file-readable-p (locate-user-emacs-file cpp-config-file))
+        (load-file (locate-user-emacs-file cpp-config-file))))
   (if (derived-mode-p 'cpp-edit-mode)
       (cpp-edit-reset)))
 
@@ -588,7 +588,7 @@ cpp-edit-save
   (with-current-buffer cpp-edit-buffer
     (let* ((config-file (if (file-writable-p cpp-config-file)
                             cpp-config-file
-                          (concat "~/" cpp-config-file)))
+                          (locate-user-emacs-file cpp-config-file)))
            (buffer (find-file-noselect config-file))
            )
       (set-buffer buffer)





reply via email to

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