* With /sudo::/etc instead of /etc, files are not conf mode by default
@ 2007-08-05 4:12 trentbuck
2007-08-05 9:09 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: trentbuck @ 2007-08-05 4:12 UTC (permalink / raw)
To: bug-gnu-emacs; +Cc: trentbuck
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.
In GNU Emacs 22.1.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2007-07-07 on nautilus, modified by Debian
configured using `configure '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.1/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: C
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_AU.utf8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
xterm-mouse-mode: t
savehist-mode: t
shell-dirtrack-mode: t
icomplete-mode: t
partial-completion-mode: t
show-paren-mode: t
delete-selection-mode: t
encoded-kbd-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
ESC x r e p o r t SPC RET
Recent messages:
Loading savehist...done
Loading ido...done
Loading xt-mouse...done
Loading edmacro...done
Loading server...done
Loading term/xterm...done
For information about the GNU Project and its goals, type C-h C-p.
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: With /sudo::/etc instead of /etc, files are not conf mode by default
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
2007-08-05 9:27 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2007-08-05 9:09 UTC (permalink / raw)
To: trentbuck; +Cc: bug-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: With /sudo::/etc instead of /etc, files are not conf mode by default
2007-08-05 9:09 ` Michael Albinus
@ 2007-08-05 9:27 ` Andreas Schwab
2007-08-05 12:30 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2007-08-05 9:27 UTC (permalink / raw)
To: Michael Albinus; +Cc: trentbuck, bug-gnu-emacs
Michael Albinus <michael.albinus@gmx.de> writes:
> - (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))
The remote-id is not a regex. And tramp does not even return a string,
so it won't help here anyway.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: With /sudo::/etc instead of /etc, files are not conf mode by default
2007-08-05 9:27 ` Andreas Schwab
@ 2007-08-05 12:30 ` Michael Albinus
0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2007-08-05 12:30 UTC (permalink / raw)
To: Andreas Schwab; +Cc: trentbuck, bug-gnu-emacs
Andreas Schwab <schwab@suse.de> writes:
> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> - (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))
>
> The remote-id is not a regex.
Right. It shall be (regexp-quote (file-remote-p buffer-file-name))
> And tramp does not even return a string, so it won't help here anyway.
Grr, that's a change in Tramp 2.1, which has been put in the Emacs
trunk.
Because it doesn't harm, I'll change the return value format of
tramp-handle-file-remote-p in EMACS_22_BASE as well.
> Andreas.
Best regards, Michael (who should be more careful on a sunny Sunday afternoon).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-05 12:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-08-05 9:27 ` Andreas Schwab
2007-08-05 12:30 ` Michael Albinus
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.