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, 03 Oct 2017 20:19:05 +0900 (JST)

cpp.el tries to load ./.cpp.el even when it is not readable.  Though
it checks ~/.cpp.el can be readable, it still tries to load ./.cpp.el.

A patch is attached to the end of this mail.

In GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.19)
 of 2017-09-12 built on buildvm-08.phx2.fedoraproject.org
Windowing system distributor 'Fedora Project', version 11.0.11903000
System Description:     Fedora release 26 (Twenty Six)

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg
 --with-png --with-rsvg --with-tiff --with-xft --with-xpm
 --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules
 build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -m64 -mtune=generic' LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS

Important settings:
  value of $LC_MONETARY: ja_JP.UTF-8
  value of $LC_NUMERIC: ja_JP.UTF-8
  value of $LC_TIME: ja_JP.UTF-8
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  which-function-mode: t
  show-paren-mode: t
  savehist-mode: t
  winner-mode: t
  iswitchb-mode: t
  editorconfig-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Undo! [2 times]
Mark set [5 times]
Saving file /home/yamato/var/emacs/MESSAGE...
Wrote /home/yamato/var/emacs/MESSAGE
line-move-visual: Beginning of buffer [13 times]
Mark set
Saving file /home/yamato/var/emacs/MESSAGE...
Wrote /home/yamato/var/emacs/MESSAGE
Saving file /home/yamato/var/emacs/MESSAGE...
Wrote /home/yamato/var/emacs/MESSAGE
line-move-visual: Beginning of buffer [7 times]

Load-path shadows:
/home/yamato/.emacs.d/ioccur hides /home/yamato/.emacs.d/elpa/ioccur-2.4/ioccur
/home/yamato/.emacs.d/markdown-mode hides 
/home/yamato/.emacs.d/elpa/markdown-mode-20160928.932/markdown-mode
/home/yamato/.emacs.d/bs hides /usr/share/emacs/25.3/lisp/bs

Features:
(shadow emacsbug message idna rfc822 mml mml-sec epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums bug-reference cpp whitespace
go-mode find-file ffap css-mode ruby-mode markdown-mode ewoc eww
mm-url gnus gnus-ems nnheader mail-utils url-queue url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse url-vars mailcap shr dom debug tramp-cache
cmake-mode rx nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt
rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util
nxml-glyph nxml-enc xmltok desktop-entry-mode conf-mode js sgml-mode
lookup-entry lookup-content lookup-vse ndtp lookup lookup-types
lookup-utils lookup-vars evi evi-mule smerge-mode novice log-view
pcvs-util vc-annotate tex-mode latexenc ediff-merg ediff-wind
ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff python
tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize
format-spec json map rst eieio-opt speedbar sb-image ezimage dframe
find-func bat-mode make-mode yaml-mode dabbrev ispell vc pcmpl-unix
autoconf autoconf-mode vc-git diff-mode sh-script smie executable rect
skk-isearch skk-comp skk-cdb cdb skk-num skk-tankan skk-cursor
skk-server skk-cus cus-edit skk skk-emacs skk-macs hl-line shell
pcomplete thingatpt tabify man parse-time cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs misearch
multi-isearch skk-vars dired-aux zoom-frm frame-cmds frame-fns pp qp
network-stream nsm auth-source gnus-util mm-util help-fns mail-prsvr
password-cache starttls tls gnutls mew-varsx mew-unix warnings ccc
spelunker etags xref project eieio eieio-core assoc ibuf-macs ibuf-ext
ibuffer grep srpmix-guess col-highlight vline dee-record scheme
edit-string tour stitch vc-dispatcher vc-svn editorconfig-core
editorconfig-core-handle editorconfig-fnmatch avoid add-log mew-w3m
w3m doc-view subr-x jka-compr image-mode timezone w3m-hist w3m-fb
bookmark-w3m w3m-ems wid-edit w3m-ccl w3m-favicon w3m-image w3m-proc
w3m-util mew-auth mew-config mew-imap2 mew-imap mew-nntp2 mew-nntp
mew-pop mew-smtp mew-ssl mew-ssh mew-net mew-highlight mew-sort
mew-fib mew-ext mew-refile mew-demo mew-attach mew-draft mew-message
mew-thread mew-virtual mew-summary4 mew-summary3 mew-summary2
mew-summary mew-search mew-pick mew-passwd mew-scan mew-syntax mew-bq
mew-smime mew-pgp mew-header mew-exec mew-mark mew-mime mew-edit
mew-decode mew-encode mew-cache mew-minibuf mew-complete mew-addrbook
mew-local mew-vars3 mew-vars2 mew-vars mew-env mew-mule3 mew-mule
mew-gemacs mew-key mew-func mew-blvs mew-const mew mew-ical cal-menu
calendar cal-loaddefs browse-url tango-dark-theme which-func imenu
paren savehist cus-start cus-load yamato izonmoji-mode ccl dired-tar
compile comint ansi-color server winner ring windmove gauche
scheme-complete graphviz-dot-mode ioccur cl-seq cl-macs edmacro kmacro
wdired noutline outline easy-mmode cl derived dired-x dired iswitchb
editorconfig finder-inf info go-mode-autoloads ioccur-autoloads
minimap-autoloads register-list-autoloads package epg-config seq
byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv
cl-loaddefs pcase cl-lib mozc skk-leim time-date mule-util advice
skk-setup skk-autoloads tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting
font-render-setting xwidget-internal move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 2902878 333248)
 (symbols 48 64343 1)
 (miscs 40 9256 11314)
 (strings 32 199064 26399)
 (string-bytes 1 6554129)
 (vectors 16 87195)
 (vector-slots 8 2451990 90410)
 (floats 8 1375 3690)
 (intervals 56 491991 4413)
 (buffers 976 519))

commit f8c0c6c11c9cce6429476070bcc550526d534651 (HEAD -> master)
Author: Masatake YAMATO <address@hidden>
Date:   Tue Oct 3 20:18:06 2017 +0900

    Fix reading and writing cpp-config-file under home directory
    
    * 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.

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 @@ You can also use the keyboard accelerators indicated like 
this: [K]ey."
        ((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 @@ You can also use the keyboard accelerators indicated like 
this: [K]ey."
   (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 @@ You can also use the keyboard accelerators indicated like 
this: [K]ey."
                (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."





reply via email to

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