From: Michael Albinus <michael.albinus@gmx.de>
To: trentbuck@gmail.com
Cc: bug-gnu-emacs@gnu.org
Subject: Re: With /sudo::/etc instead of /etc, files are not conf mode by default
Date: Sun, 05 Aug 2007 11:09:10 +0200 [thread overview]
Message-ID: <87zm161h6x.fsf@gmx.de> (raw)
In-Reply-To: <87bqdmbox1.fsf@baal.twb.ath.cx> (trentbuck@gmail.com's message of "Sun, 05 Aug 2007 14:12:10 +1000")
trentbuck@gmail.com writes:
> The file /etc/default/tftpd-hpa uses conf mode by default, presumably
> due to auto-mode-alist. However, opening the same file with TRAMP's
> sudo method: /sudo::/etc/default/tftpd-hpa, causes it to be in
> fundamental mode. Presumably this is because the auto-mode-alist
> entry uses ^/ to match the root directory or similar.
The following patch should fix it. It will appear also in Emacs 22.2.
Thanks for reporting, and best regards, Michael.
Index: lisp/files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.896.2.5
retrieving revision 1.896.2.11
diff -u -u -r1.896.2.5 -r1.896.2.11
--- lisp/files.el 22 May 2007 11:41:33 -0000 1.896.2.5
+++ lisp/files.el 5 Aug 2007 08:57:24 -0000 1.896.2.11
@@ -2254,7 +2254,12 @@
;; Next compare the filename against the entries in auto-mode-alist.
(unless done
(if buffer-file-name
- (let ((name buffer-file-name))
+ (let ((name buffer-file-name)
+ (remote-id (file-remote-p buffer-file-name)))
+ ;; Remove remote file name identification.
+ (when (and (stringp remote-id)
+ (string-match remote-id name))
+ (setq name (substring name (match-end 0))))
;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name))
(while name
next prev parent reply other threads:[~2007-08-05 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 4:12 With /sudo::/etc instead of /etc, files are not conf mode by default trentbuck
2007-08-05 9:09 ` Michael Albinus [this message]
2007-08-05 9:27 ` Andreas Schwab
2007-08-05 12:30 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zm161h6x.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=bug-gnu-emacs@gnu.org \
--cc=trentbuck@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.