aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/dired.texi8
-rw-r--r--doc/emacs/files.texi9
-rw-r--r--doc/misc/tramp.texi24
-rw-r--r--etc/NEWS76
-rw-r--r--lisp/bindings.el3
-rw-r--r--lisp/dired.el1
-rw-r--r--lisp/net/tramp-cmds.el55
7 files changed, 119 insertions, 57 deletions
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 07142e71713..f52b001c121 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -460,6 +460,14 @@ View the file described on the current line, with View mode
460(@code{dired-view-file}). View mode provides convenient commands to 460(@code{dired-view-file}). View mode provides convenient commands to
461navigate the buffer but forbids changing it; @xref{View Mode}. 461navigate the buffer but forbids changing it; @xref{View Mode}.
462 462
463@item @@
464@kindex @@ @r{(Dired)}
465@findex tramp-dired-find-file-with-sudo
466Open the file described on the current line, with root permissions
467(@code{tramp-dired-find-file-with-sudo}). Calling it with the @kbd{C-u}
468prefix argument asks for another Tramp method interactively but
469@option{sudo}. @xref{Ad-hoc multi-hops, Tramp,, tramp, The Tramp Manual}.
470
463@item ^ 471@item ^
464@kindex ^ @r{(Dired)} 472@kindex ^ @r{(Dired)}
465@findex dired-up-directory 473@findex dired-up-directory
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index d11d7767353..9b2ce5c5ee2 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1174,6 +1174,15 @@ the major mode actually turned on as result of reverting a buffer
1174depends on mode remapping, and could be different from the original mode 1174depends on mode remapping, and could be different from the original mode
1175if you customized @code{major-mode-remap-alist} in-between. 1175if you customized @code{major-mode-remap-alist} in-between.
1176 1176
1177@cindex reverting with root permissions
1178@findex tramp-revert-buffer-with-sudo
1179@kindex C-x x @@
1180A variant of reverting a buffer is visiting it by the
1181@code{tramp-revert-buffer-with-sudo} (@kbd{C-x x @@}) command. It
1182reopens the file or Dired buffer with root permissions. With a prefix
1183argument of @kbd{C-u}, you could change the default Tramp method
1184(@option{sudo}). @xref{Ad-hoc multi-hops, Tramp,, tramp, The Tramp Manual}.
1185
1177@node Auto Revert 1186@node Auto Revert
1178@section Auto Revert: Keeping buffers automatically up-to-date 1187@section Auto Revert: Keeping buffers automatically up-to-date
1179@cindex Global Auto Revert mode 1188@cindex Global Auto Revert mode
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 81feb56ec31..6e66de552de 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -3928,23 +3928,31 @@ containers on the remote host.
3928 3928
3929A common use case for ad-hoc specifications is to visit a file or a 3929A common use case for ad-hoc specifications is to visit a file or a
3930directory with proper permissions, for example with the @option{sudo} 3930directory with proper permissions, for example with the @option{sudo}
3931method. The command @code{tramp-revert-buffer-with-sudo} supports 3931method. The commands @code{tramp-revert-buffer-with-sudo} (@kbd{C-x x
3932this. 3932@@}), and @code{tramp-dired-find-file-with-sudo} (@kbd{@@} in
3933@code{dired-mode}) support this.
3933 3934
3935@kindex C-x x @@
3934@deffn Command tramp-revert-buffer-with-sudo 3936@deffn Command tramp-revert-buffer-with-sudo
3935This command shows the current buffer with @option{sudo} permissions. 3937This command shows the current buffer with @option{sudo} permissions.
3936The buffer must either visit a file, or a directory 3938The buffer must either visit a file, or a directory
3937(@code{dired-mode}). 3939(@code{dired-mode}).
3938@end deffn 3940@end deffn
3939 3941
3942@kindex @@ @r{(in dired})
3943@deffn Command tramp-dired-find-file-with-sudo
3944In @code{dired-mode}, visit the file or directory named on this line.
3945This is performed with @option{sudo} permissions.
3946@end deffn
3947
3940@defopt tramp-file-name-with-method 3948@defopt tramp-file-name-with-method
3941The method @code{tramp-revert-buffer-with-sudo} shows an alternate 3949The method used in @code{tramp-revert-buffer-with-sudo} and
3942buffer. It defaults to @option{sudo}, other valid methods are 3950@code{tramp-dired-find-file-with-sudo}. It defaults to @option{sudo},
3943@option{su}, @option{doas}, @option{run0}, and @option{ksu}. 3951other valid methods are @option{su}, @option{doas}, @option{run0}, and
3952@option{ksu}.
3944 3953
3945@lisp 3954If a command is called with a prefix argument @kbd{C-u}, the option's
3946(customize-set-variable 'tramp-file-name-with-method "doas") 3955value is read interactively.
3947@end lisp
3948@end defopt 3956@end defopt
3949 3957
3950These methods apply the user @samp{root} as default. If another user 3958These methods apply the user @samp{root} as default. If another user
diff --git a/etc/NEWS b/etc/NEWS
index 5ebc109f734..e634de18c69 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -285,7 +285,6 @@ return value windows whose buffers share their text with BUFFER-OR-NAME.
285With such an entry, 'display-buffer-reuse-window' may also choose a 285With such an entry, 'display-buffer-reuse-window' may also choose a
286window whose buffer shares text with the buffer to display. 286window whose buffer shares text with the buffer to display.
287 287
288
289** Frames 288** Frames
290 289
291+++ 290+++
@@ -294,7 +293,7 @@ Calling this function before 'delete-frame' is useful to avoid that the
294latter throws an error when the argument FRAME cannot be deleted. 293latter throws an error when the argument FRAME cannot be deleted.
295 294
296+++ 295+++
297*** New value 'force' for option `frame-inhibit-implied-resize'. 296*** New value 'force' for user option 'frame-inhibit-implied-resize'.
298This will inhibit implied resizing while a new frame is made and can be 297This will inhibit implied resizing while a new frame is made and can be
299useful on tiling window managers where the initial frame size should be 298useful on tiling window managers where the initial frame size should be
300specified by external means. 299specified by external means.
@@ -363,8 +362,6 @@ invoked standalone or from the 'project-switch-commands' dispatch menu.
363This user option describes projects that should always be skipped by 362This user option describes projects that should always be skipped by
364'project-remember-project'. 363'project-remember-project'.
365 364
366***
367
368** Registers 365** Registers
369 366
370*** New functions 'buffer-to-register' and 'file-to-register'. 367*** New functions 'buffer-to-register' and 'file-to-register'.
@@ -396,14 +393,14 @@ please contact us if you still need it for some reason.
396 393
397--- 394---
398** Modified settings for an enabled theme now apply immediately. 395** Modified settings for an enabled theme now apply immediately.
399Evaluating a custom-theme-set-faces or custom-theme-set-variables 396Evaluating a 'custom-theme-set-faces' or 'custom-theme-set-variables'
400call for an enabled theme causes the settings to apply immediately, 397call for an enabled theme causes the settings to apply immediately,
401without a need to re-load the theme. 398without a need to re-load the theme.
402 399
403--- 400---
404** 'describe-variable' now automatically says if 'setopt' is needed. 401** 'describe-variable' now automatically says if 'setopt' is needed.
405If a user option has a defcustom :set function, users will normally need 402If a user option has a defcustom ':set' function, users will normally
406to set it with 'setopt' for it to take an effect. If the docstring 403need to set it with 'setopt' for it to take an effect. If the docstring
407doesn't already mention 'setopt', the 'describe-variable' command will 404doesn't already mention 'setopt', the 'describe-variable' command will
408now add a note about this automatically. 405now add a note about this automatically.
409 406
@@ -545,6 +542,7 @@ default is nil, which retains the old format.
545*** The terminal emulator now supports auto-margins control. 542*** The terminal emulator now supports auto-margins control.
546Term mode now handles DECAWM escape sequences that control whether text 543Term mode now handles DECAWM escape sequences that control whether text
547automatically wraps at the right margin: 544automatically wraps at the right margin:
545
548- \e[?7h enables auto-margins (default) 546- \e[?7h enables auto-margins (default)
549- \e[?7l disables auto-margins 547- \e[?7l disables auto-margins
550 548
@@ -603,12 +601,13 @@ Emacs 25.1), and gnudoit (obsolete since Emacs 25.1).
603*** Some cl-lib functions and macros are now built-in. 601*** Some cl-lib functions and macros are now built-in.
604These functions or macros have been added to Emacs Lisp, and the old 602These functions or macros have been added to Emacs Lisp, and the old
605names are now aliases for the built-in equivalents: 603names are now aliases for the built-in equivalents:
606 - 'cl-incf' renamed to 'incf' 604
607 - 'cl-decf' renamed to 'decf' 605- 'cl-incf' renamed to 'incf'
608 - 'cl-oddp' renamed to 'oddp' 606- 'cl-decf' renamed to 'decf'
609 - 'cl-evenp' renamed to 'evenp' 607- 'cl-oddp' renamed to 'oddp'
610 - 'cl-plusp' renamed to 'plusp' 608- 'cl-evenp' renamed to 'evenp'
611 - 'cl-minusp' renamed to 'minusp' 609- 'cl-plusp' renamed to 'plusp'
610- 'cl-minusp' renamed to 'minusp'
612 611
613The old names are considered deprecated, and will be marked as obsolete 612The old names are considered deprecated, and will be marked as obsolete
614in some future release. 613in some future release.
@@ -687,6 +686,7 @@ minibuffer use, they are now saved only once in the file specified by
687'savehist-file'. Previously, they were saved twice. 686'savehist-file'. Previously, they were saved twice.
688 687
689** Rectangle Mark 688** Rectangle Mark
689
690--- 690---
691*** New user option to control whether empty rectangle selections are shown. 691*** New user option to control whether empty rectangle selections are shown.
692The new user option 'rectangle-indicate-zero-width-rectangle' can be 692The new user option 'rectangle-indicate-zero-width-rectangle' can be
@@ -740,9 +740,8 @@ It removes all the buttons in the specified region.
740 740
741** Shell 741** Shell
742 742
743--- 743+++
744*** Shell buffers now support bookmarks. 744*** Shell buffers now support bookmarks.
745
746You can now bookmark local and remote shell buffers using the bookmark 745You can now bookmark local and remote shell buffers using the bookmark
747menu 'bookmark-bmenu-list', or by using the command 'bookmark-set'. 746menu 'bookmark-bmenu-list', or by using the command 'bookmark-set'.
748Shell bookmarks can be loaded via the menu and by using the command 747Shell bookmarks can be loaded via the menu and by using the command
@@ -1021,7 +1020,7 @@ positives.
1021 1020
1022--- 1021---
1023*** IELM input history is now saved also when the IELM process is killed. 1022*** IELM input history is now saved also when the IELM process is killed.
1024When you kill the IELM process with "C-c C-c", the input history is now 1023When you kill the IELM process with 'C-c C-c', the input history is now
1025saved to the file specified by 'ielm-history-file-name', just like when 1024saved to the file specified by 'ielm-history-file-name', just like when
1026you exit the Emacs session or kill the IELM buffer. 1025you exit the Emacs session or kill the IELM buffer.
1027 1026
@@ -1077,6 +1076,16 @@ cherry pick via 'tramp-cleanup-connection' or clear them all via
1077'tramp-cleanup-all-connections'. 1076'tramp-cleanup-all-connections'.
1078 1077
1079+++ 1078+++
1079*** New command 'tramp-dired-find-file-with-sudo'.
1080This command, bound to '@' in Dired, visits the file or directory on the
1081recent Dired line with root permissions.
1082
1083+++
1084*** Command 'tramp-revert-buffer-with-sudo' is bound to 'C-x x @' now.
1085Called with the prefix argument 'C-u', the used Tramp method is asked
1086interactively. This happens also for 'tramp-dired-find-file-with-sudo'.
1087
1088+++
1080*** Connection method "kubernetes" supports now optional namespace. 1089*** Connection method "kubernetes" supports now optional namespace.
1081The host name for Kubernetes connections can be of kind 1090The host name for Kubernetes connections can be of kind
1082[CONTAINER.]POD[%NAMESPACE], in order to specify the namespace to be 1091[CONTAINER.]POD[%NAMESPACE], in order to specify the namespace to be
@@ -1371,19 +1380,19 @@ the directory into which the repository was cloned.
1371*** 'C-x v u' ('vc-revert') now works on directories listed in VC Directory. 1380*** 'C-x v u' ('vc-revert') now works on directories listed in VC Directory.
1372Reverting a directory means reverting changes to all files inside it. 1381Reverting a directory means reverting changes to all files inside it.
1373 1382
1374*** New function 'log-edit-done-strip-cvs-lines'. 1383*** New command 'log-edit-done-strip-cvs-lines'.
1375This function strips all lines beginning with "CVS:" from the buffer. 1384This command strips all lines beginning with "CVS:" from the buffer.
1376It is intended to be added to the 'log-edit-done-hook' so that 1385It is intended to be added to the 'log-edit-done-hook' so that
1377'vc-cvs-checkin' behaves like invoking "cvs commit [files...]" from the 1386'vc-cvs-checkin' behaves like invoking 'cvs commit [files...]' from the
1378command line. 1387command line.
1379 1388
1380** Diff mode 1389** Diff mode
1381 1390
1382+++ 1391+++
1383*** diff-apply-buffer now considers the region and can reverse-apply. 1392*** 'diff-apply-buffer' now considers the region and can reverse-apply.
1384If the region is active, this command now applies all hunks that the 1393If the region is active, this command now applies all hunks that the
1385region overlaps; otherwise, it applies all hunks. 1394region overlaps; otherwise, it applies all hunks.
1386With a prefix arguments, it now reverse-applies the hunks. 1395With a prefix argument, it now reverse-applies the hunks.
1387This matches the existing prefix argument to 'diff-apply-hunk'. 1396This matches the existing prefix argument to 'diff-apply-hunk'.
1388 1397
1389** Package 1398** Package
@@ -1448,13 +1457,13 @@ runs its body, and removes the current buffer from
1448** Strokes 1457** Strokes
1449 1458
1450-- 1459--
1451** 'strokes-mode' no longer demands the presence of a mouse. 1460*** 'strokes-mode' no longer demands the presence of a mouse.
1452'strokes-mode' now permits itself to be enabled if no mouse is 1461'strokes-mode' now permits itself to be enabled if no mouse is
1453connected, to facilitate enabling 'strokes-mode' in sessions where the 1462connected, to facilitate enabling 'strokes-mode' in sessions where the
1454availability of a mouse device varies during execution (as is frequently 1463availability of a mouse device varies during execution (as is frequently
1455observed on Android). 1464observed on Android).
1456 1465
1457** Yank media 1466** Yank Media
1458 1467
1459+++ 1468+++
1460*** 'yank-media' now auto-selects the most preferred MIME type. 1469*** 'yank-media' now auto-selects the most preferred MIME type.
@@ -1472,7 +1481,7 @@ the 'remember-buffer'. This allows users to customize the major mode
1472used to write notes. 1481used to write notes.
1473 1482
1474--- 1483---
1475*** New handler that append remember data in directory. 1484*** New handler that appends remember data in directory.
1476The 'remember-append-in-data-directory' handler appends remember data in 1485The 'remember-append-in-data-directory' handler appends remember data in
1477a file, that file being choosen by the user through the minibuffer. 1486a file, that file being choosen by the user through the minibuffer.
1478 1487
@@ -1593,28 +1602,28 @@ restore the old behavior, you can set 'eshell-pwd-convert-function' to
1593'identity'. 1602'identity'.
1594 1603
1595--- 1604---
1596** The rx 'eval' form now uses the current elisp dialect for evaluation. 1605** The rx 'eval' form now uses the current Elisp dialect for evaluation.
1597Previously, its argument was always evaluated using dynamic binding. 1606Previously, its argument was always evaluated using dynamic binding.
1598 1607
1599 1608
1600* Lisp Changes in Emacs 31.1 1609* Lisp Changes in Emacs 31.1
1601 1610
1602+++ 1611+++
1603** New macros 'static-when' and 'static-unless' implement conditional 1612** New macros 'static-when' and 'static-unless'.
1604compilation like 'static-if'. 1613Like 'static-if', these macros evaluate their condition at
1605These macros evaluate their condition at macro-expansion time and are useful 1614macro-expansion time and are useful for writing code that can work
1606for writing code that can work across different Emacs versions. 1615across different Emacs versions.
1607 1616
1608--- 1617---
1609** You can change the default value of 'lexical-binding'. 1618** You can change the default value of 'lexical-binding'.
1610While the default is still the use dynamic binding dialect of Elisp 1619While the default is still the use of dynamic binding dialect of Elisp
1611in those places that don't explicitly set 'lexical-binding' you can 1620in those places that don't explicitly set 'lexical-binding' you can
1612change it globally with: 1621change it globally with:
1613 1622
1614 (set-default-toplevel-value 'lexical-binding t) 1623 (set-default-toplevel-value 'lexical-binding t)
1615 1624
1616+++ 1625+++
1617*** New macros 'incf' and 'decf'. 1626** New macros 'incf' and 'decf'.
1618They increment or decrement the value stored in a variable (a symbol), 1627They increment or decrement the value stored in a variable (a symbol),
1619or in a generalized variable. 1628or in a generalized variable.
1620 1629
@@ -1638,11 +1647,12 @@ This means that you can now call it with just one argument, like
1638*** Some experimental ERT macros are now considered stable. 1647*** Some experimental ERT macros are now considered stable.
1639The following macros, previously only available in the experimental 1648The following macros, previously only available in the experimental
1640'ert-x' module, are now considered stable and have been moved to 'ert': 1649'ert-x' module, are now considered stable and have been moved to 'ert':
1650
1641- ert-with-test-buffer 1651- ert-with-test-buffer
1642- ert-with-buffer-selected 1652- ert-with-buffer-selected
1643- ert-with-buffer-renamed 1653- ert-with-buffer-renamed
1644 1654
1645See the ERT manual for more information. 1655See "(ert) Helper Functions" node in the ERT manual for more information.
1646 1656
1647** Time & Date 1657** Time & Date
1648 1658
@@ -1852,7 +1862,7 @@ maps will not activate the repeat map in 'repeat-mode'. It will only
1852continue the already activated repeating sequence. Also 'defvar-keymap' 1862continue the already activated repeating sequence. Also 'defvar-keymap'
1853supports a new keyword ':continue' with a list of commands that only 1863supports a new keyword ':continue' with a list of commands that only
1854continue the active repeating sequence, and the 'use-package' and 1864continue the active repeating sequence, and the 'use-package' and
1855'bind-keys' macros supports a similar keyword ':continue-only'. 1865'bind-keys' macros support a similar keyword ':continue-only'.
1856 1866
1857** New function 'completion-table-with-metadata'. 1867** New function 'completion-table-with-metadata'.
1858It offers a more concise way to create a completion table with metadata. 1868It offers a more concise way to create a completion table with metadata.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index f829c1bea26..a5737db840b 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1606,7 +1606,8 @@ if `inhibit-field-text-motion' is non-nil."
1606 "u" #'rename-uniquely 1606 "u" #'rename-uniquely
1607 "n" #'clone-buffer 1607 "n" #'clone-buffer
1608 "i" #'insert-buffer 1608 "i" #'insert-buffer
1609 "t" #'toggle-truncate-lines) 1609 "t" #'toggle-truncate-lines
1610 "@" #'tramp-revert-buffer-with-sudo)
1610(define-key ctl-x-map "x" ctl-x-x-map) 1611(define-key ctl-x-map "x" ctl-x-x-map)
1611 1612
1612(define-key esc-map "\C-l" 'reposition-window) 1613(define-key esc-map "\C-l" 'reposition-window)
diff --git a/lisp/dired.el b/lisp/dired.el
index 68e1da13171..b5bb658b503 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2416,6 +2416,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
2416 "x" #'dired-do-flagged-delete 2416 "x" #'dired-do-flagged-delete
2417 "y" #'dired-show-file-type 2417 "y" #'dired-show-file-type
2418 "+" #'dired-create-directory 2418 "+" #'dired-create-directory
2419 "@" #'tramp-dired-find-file-with-sudo
2419 ;; moving 2420 ;; moving
2420 "<" #'dired-prev-dirline 2421 "<" #'dired-prev-dirline
2421 ">" #'dired-next-dirline 2422 ">" #'dired-next-dirline
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index cba300049ae..be122642b96 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -32,6 +32,7 @@
32 32
33;; Pacify byte-compiler. 33;; Pacify byte-compiler.
34(declare-function dired-advertise "dired") 34(declare-function dired-advertise "dired")
35(declare-function dired-get-file-for-visit "dired")
35(declare-function dired-unadvertise "dired") 36(declare-function dired-unadvertise "dired")
36(declare-function mml-mode "mml") 37(declare-function mml-mode "mml")
37(declare-function mml-insert-empty-tag "mml") 38(declare-function mml-insert-empty-tag "mml")
@@ -637,6 +638,19 @@ For details, see `tramp-rename-files'."
637 (const "ksu")) 638 (const "ksu"))
638 :link '(tramp-info-link :tag "Tramp manual" tramp-file-name-with-method)) 639 :link '(tramp-info-link :tag "Tramp manual" tramp-file-name-with-method))
639 640
641(defmacro with-tramp-file-name-with-method (&rest body)
642 "Ask user for `tramp-file-name-with-method' if needed.
643Run BODY."
644 (declare (indent 0) (debug t))
645 `(let ((tramp-file-name-with-method
646 (if current-prefix-arg
647 (completing-read
648 "Tramp method: "
649 (mapcar #'cadr (cdr (get 'tramp-file-name-with-method 'custom-type)))
650 nil t tramp-file-name-with-method)
651 tramp-file-name-with-method)))
652 ,@body))
653
640(defun tramp-file-name-with-sudo (filename) 654(defun tramp-file-name-with-sudo (filename)
641 "Convert FILENAME into a multi-hop file name with \"sudo\". 655 "Convert FILENAME into a multi-hop file name with \"sudo\".
642An alternative method could be chosen with `tramp-file-name-with-method'." 656An alternative method could be chosen with `tramp-file-name-with-method'."
@@ -669,27 +683,38 @@ An alternative method could be chosen with `tramp-file-name-with-method'."
669 (make-tramp-file-name 683 (make-tramp-file-name
670 :method tramp-file-name-with-method :localname filename)))) 684 :method tramp-file-name-with-method :localname filename))))
671 685
672;;;###tramp-autoload 686;;;###autoload
673(defun tramp-revert-buffer-with-sudo () 687(defun tramp-revert-buffer-with-sudo ()
674 "Revert current buffer to visit with \"sudo\" permissions. 688 "Revert current buffer to visit with \"sudo\" permissions.
675An alternative method could be chosen with `tramp-file-name-with-method'. 689An alternative method could be chosen with `tramp-file-name-with-method'.
676If the buffer visits a file, the file is replaced. 690If the buffer visits a file, the file is replaced.
677If the buffer runs `dired', the buffer is reverted." 691If the buffer runs `dired', the buffer is reverted."
678 (interactive) 692 (interactive)
679 (cond 693 (with-tramp-file-name-with-method
680 ((buffer-file-name) 694 (cond
681 (find-alternate-file (tramp-file-name-with-sudo (buffer-file-name)))) 695 ((buffer-file-name)
682 ((tramp-dired-buffer-p) 696 (let ((pos (point)))
683 (dired-unadvertise (expand-file-name default-directory)) 697 (find-alternate-file (tramp-file-name-with-sudo (buffer-file-name)))
684 (setq default-directory (tramp-file-name-with-sudo default-directory) 698 (goto-char pos)))
685 list-buffers-directory 699 ((tramp-dired-buffer-p)
686 (tramp-file-name-with-sudo list-buffers-directory)) 700 (dired-unadvertise (expand-file-name default-directory))
687 (if (consp dired-directory) 701 (setq default-directory (tramp-file-name-with-sudo default-directory)
688 (setcar 702 list-buffers-directory
689 dired-directory (tramp-file-name-with-sudo (car dired-directory))) 703 (tramp-file-name-with-sudo list-buffers-directory))
690 (setq dired-directory (tramp-file-name-with-sudo dired-directory))) 704 (if (consp dired-directory)
691 (dired-advertise) 705 (setcar
692 (revert-buffer)))) 706 dired-directory (tramp-file-name-with-sudo (car dired-directory)))
707 (setq dired-directory (tramp-file-name-with-sudo dired-directory)))
708 (dired-advertise)
709 (revert-buffer)))))
710
711;;;###autoload
712(defun tramp-dired-find-file-with-sudo ()
713 "In Dired, visit the file or directory named on this line.
714This is performed with \"sudo\" permissions."
715 (interactive)
716 (with-tramp-file-name-with-method
717 (find-file (tramp-file-name-with-sudo (dired-get-file-for-visit)))))
693 718
694;;; Recompile on ELPA 719;;; Recompile on ELPA
695 720