From 00d15729c28b5f8c9fd58a7be02ba98373d5db2f Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Sat, 27 Jul 2019 01:00:50 +0200 Subject: [PATCH 06/10] gnu: Add emacs-dired-toggle-sudo. * gnu/packages/emacs-xyz.scm (emacs-dired-toggle-sudo): New variable. * gnu/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/emacs-xyz.scm | 24 +++++++++ .../emacs-dired-toggle-sudo-emacs-26.patch | 49 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 gnu/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch diff --git a/gnu/local.mk b/gnu/local.mk index bd509647dc..92fa4f37a9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -772,6 +772,7 @@ dist_patch_DATA = \ %D%/packages/patches/elfutils-tests-ptrace.patch \ %D%/packages/patches/elixir-path-length.patch \ %D%/packages/patches/einstein-build.patch \ + %D%/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch \ %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ %D%/packages/patches/emacs-json-reformat-fix-tests.patch \ diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index 18edb58d87..73a7668b08 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -7185,6 +7185,30 @@ above over the network.") in Org buffers and displays matching entries.") (license license:gpl3+))) +(define-public emacs-dired-toggle-sudo + (package + (name "emacs-dired-toggle-sudo") + (version "1.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/renard/dired-toggle-sudo") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0ajj8d6k5in2hclcrqckinfh80ylddplva0ryfbkzsjkfq167cv2")) + (patches + (search-patches + "emacs-dired-toggle-sudo-emacs-26.patch")))) + (build-system emacs-build-system) + (home-page "https://github.com/renard/dired-toggle-sudo") + (synopsis "Browse directory with @code{sudo} privileges") + (description "This package allows for the use of @code{dired} with +@code{sudo} privileges.") + (license license:wtfpl2))) + (define-public emacs-memoize (package (name "emacs-memoize") diff --git a/gnu/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch b/gnu/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch new file mode 100644 index 0000000000..d979b113d0 --- /dev/null +++ b/gnu/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch @@ -0,0 +1,49 @@ +From 3c0f4b27a079b90dc632f5061a81ce28cef24801 Mon Sep 17 00:00:00 2001 +From: eryx67 +Date: Thu, 29 Nov 2018 10:30:20 +0500 +Subject: [PATCH] fix for latest emacs + +--- + dired-toggle-sudo.el | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/dired-toggle-sudo.el b/dired-toggle-sudo.el +index 386921b..fe5898e 100644 +--- a/dired-toggle-sudo.el ++++ b/dired-toggle-sudo.el +@@ -37,17 +37,20 @@ + unless SUDO-USER is provided." + (let* (;; Handle the case of local files. `tramp-dissect-file-name' does + ;; not raise an error anymore. +- (path (if (tramp-tramp-file-p path) path (concat "/:" path))) ++ ;;(path (if (tramp-tramp-file-p path) path (concat "/-::" path))) + (file-vec (or (ignore-errors (tramp-dissect-file-name + path)) + (tramp-dissect-file-name +- (concat "/:" path) 1))) ++ (concat "/-::" path) 1))) + (method (tramp-file-name-method file-vec)) + (user (tramp-file-name-user file-vec)) + (host (tramp-file-name-host file-vec)) ++ (domain (tramp-file-name-domain file-vec)) ++ (port (tramp-file-name-port file-vec)) + (localname (expand-file-name + (tramp-file-name-localname file-vec)))) +- (when (string= system-name host) ++ (when (or (string= (system-name) host) ++ (string= "-" host)) + (setq host nil)) + (cond + ;; remote directory -> sudo +@@ -67,7 +70,7 @@ unless SUDO-USER is provided." + (setq method "sudo" user sudo-user))) + (replace-regexp-in-string + "^/:/" "/" +- (tramp-make-tramp-file-name method user host localname)))) ++ (tramp-make-tramp-file-name method domain user host port localname)))) + + (defun dired-toggle-sudo-find (fname) + "Create a new buffer for file name FNAME." +-- +2.22.0 + -- 2.22.0