[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28685: [PATCH 1/3] Fix reading and writing cpp-config-file under hom
From: |
Masatake YAMATO |
Subject: |
bug#28685: [PATCH 1/3] Fix reading and writing cpp-config-file under home directory |
Date: |
Sun, 22 Oct 2017 18:22:40 +0900 |
* lisp/progmodes/cpp.el (cpp-edit-load): load ~/.cpp.el when
it is readable.
(cpp-edit-save): write to ~/.cpp.el when it is wriable.
---
lisp/progmodes/cpp.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 8aaebdde5b..3a7dab72b4 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -577,7 +577,7 @@ cpp-edit-load
((file-readable-p cpp-config-file)
(load-file cpp-config-file))
((file-readable-p (concat "~/" cpp-config-file))
- (load-file cpp-config-file)))
+ (load-file (concat "~/" cpp-config-file))))
(if (derived-mode-p 'cpp-edit-mode)
(cpp-edit-reset)))
@@ -586,7 +586,11 @@ cpp-edit-save
(interactive)
(require 'pp)
(with-current-buffer cpp-edit-buffer
- (let ((buffer (find-file-noselect cpp-config-file)))
+ (let* ((config-file (if (file-writable-p cpp-config-file)
+ cpp-config-file
+ (concat "~/" cpp-config-file)))
+ (buffer (find-file-noselect config-file))
+ )
(set-buffer buffer)
(erase-buffer)
(pp (list 'setq 'cpp-known-face
@@ -601,7 +605,7 @@ cpp-edit-save
(list 'quote cpp-unknown-writable)) buffer)
(pp (list 'setq 'cpp-edit-list
(list 'quote cpp-edit-list)) buffer)
- (write-file cpp-config-file))))
+ (write-file config-file))))
(defun cpp-edit-home ()
"Switch back to original buffer."
--
2.13.6
- bug#28685: 25.3; wrong handling ~/.cpp.el, (continued)
- bug#28685: 25.3; wrong handling ~/.cpp.el, Eli Zaretskii, 2017/10/14
- bug#28685: 25.3; wrong handling ~/.cpp.el, Glenn Morris, 2017/10/14
- bug#28685: 25.3; wrong handling ~/.cpp.el, Masatake YAMATO, 2017/10/17
- bug#28685: 25.3; wrong handling ~/.cpp.el, Noam Postavsky, 2017/10/17
- bug#28685: 25.3; wrong handling ~/.cpp.el, Eli Zaretskii, 2017/10/17
- bug#28685: 25.3; wrong handling ~/.cpp.el, Masatake YAMATO, 2017/10/19
- bug#28685: 25.3; wrong handling ~/.cpp.el, Masatake YAMATO, 2017/10/19
- bug#28685: 25.3; wrong handling ~/.cpp.el, Noam Postavsky, 2017/10/20
- bug#28685: 25.3; wrong handling ~/.cpp.el, Eli Zaretskii, 2017/10/21
- bug#28685: 25.3; wrong handling ~/.cpp.el, Noam Postavsky, 2017/10/21
- bug#28685: [PATCH 1/3] Fix reading and writing cpp-config-file under home directory,
Masatake YAMATO <=
- bug#28685: [PATCH 2/3] Put .cpp.el to ~/.emacs.d if possible, Masatake YAMATO, 2017/10/22
- bug#28685: [PATCH 3/3] Put cpp config file to ~/.emacs.d/cpp.el if possible, Masatake YAMATO, 2017/10/22
- bug#28685: [PATCH 3/3] Put cpp config file to ~/.emacs.d/cpp.el if possible, Noam Postavsky, 2017/10/22