(set-window-start nil start)
(goto-char pos)))
+(defun cpp-locate-user-emacs-file (file)
+ (locate-user-emacs-file
+ ;; Remove initial '.' from file.
+ (if (eq (aref file 0) ?.)
+ (substring file 1)
+ file)
+ file))
+
(defun cpp-edit-load ()
"Load cpp configuration."
(interactive)
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 (cpp-locate-user-emacs-file cpp-config-file))
+ (load-file (cpp-locate-user-emacs-file cpp-config-file))))
(if (derived-mode-p 'cpp-edit-mode)
(cpp-edit-reset)))
(with-current-buffer cpp-edit-buffer
(let* ((config-file (if (file-writable-p cpp-config-file)
cpp-config-file
- (concat "~/" cpp-config-file)))
+ (cpp-locate-user-emacs-file cpp-config-file)))
(buffer (find-file-noselect config-file)))
(set-buffer buffer)
(erase-buffer)