From: Tino Calancha <tino.calancha@gmail.com>
To: 43028@debbugs.gnu.org
Cc: uyennhi.qm@gmail.com, jidanni@jidanni.org
Subject: bug#43028: 28.0.50; Add dired commands to navigate symbolic links
Date: Mon, 24 Aug 2020 21:12:25 +0200 [thread overview]
Message-ID: <87wo1noo2u.fsf@gmail.com> (raw)
X-Debbugs-Cc: uyennhi.qm@gmail.com, jidanni@jidanni.org,
drew.adams@oracle.com, michael_heerdegen@web.de, larsi@gnus.org
Severity: wishlist
How do you feel about adding these new navigators and bind them to
'{' '}' ?
--8<-----------------------------cut here---------------start------------->8---
commit 98e474b5b3be644d6cdff8aaf3b2d917ca4cea56
Author: Tino Calancha <ccalancha@suse.com>
Date: Mon Aug 24 20:56:27 2020 +0200
New dired commands to navigate symbolic links
Like dired-prev-dirline and dired-next-dirline
but for symbolic links.
* lisp/dired.el (dired-prev-symlinkline, dired-next-symlinkline):
New commands.
(dired-mode-map): Bind them to '{' and '}'. Add menu entries for them.
* doc/emacs/dired.texi (Dired Navigation): Document them.
* etc/NEWS (Changes in Specialized Modes and Packages in Emacs 28.1):
Announce them.
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 19aaca962d..92c1214cb4 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -177,6 +177,16 @@ Dired Navigation
minibuffer, and moves point to the line in the Dired buffer describing
that file.
+@findex dired-prev-symlinkline
+@kindex @{ @r{(Dired)}
+ @kbd{@{} (@code{dired-prev-symlinkline}) jumps to the previous
+ symbolic link in the Dired buffer.
+
+@findex dired-next-symlinkline
+@kindex @} @r{(Dired)}
+ @kbd{@}} (@code{dired-next-symlinkline}) jumps to the next
+ symbolic link in the Dired buffer.
+
@cindex searching Dired buffers
@findex dired-isearch-filenames
@vindex dired-isearch-filenames
diff --git a/etc/NEWS b/etc/NEWS
index a65852fcd0..5785cdc1e5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -235,6 +235,10 @@ time zones will use a form like "+0100" instead of "CET".
** Dired
++++
+*** New commands 'dired-prev-symlinkline', 'dired-next-symlinkline' to visit
+symbolic links in the current dired buffer, bound respectively to '{' '}'.
+
+++
*** New user option 'dired-maybe-use-globstar'.
If set, enables globstar (recursive globbing) in shells that support
diff --git a/lisp/dired.el b/lisp/dired.el
index 94d3befda8..273e787af0 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1898,6 +1898,8 @@ dired-mode-map
;; moving
(define-key map "<" 'dired-prev-dirline)
(define-key map ">" 'dired-next-dirline)
+ (define-key map "}" 'dired-next-symlinkline)
+ (define-key map "{" 'dired-prev-symlinkline)
(define-key map "^" 'dired-up-directory)
(define-key map " " 'dired-next-line)
(define-key map [?\S-\ ] 'dired-previous-line)
@@ -2039,6 +2041,12 @@ dired-mode-map
(define-key map [menu-bar immediate find-file]
'(menu-item "Find This File" dired-find-file
:help "Edit file at cursor"))
+ (define-key map [menu-bar immediate prev-symlink]
+ '(menu-item "Prev Symlink" dired-prev-symlinkline
+ :help "Move to next symbolic link line"))
+ (define-key map [menu-bar immediate next-symlink]
+ '(menu-item "Next Symlink" dired-next-symlinkline
+ :help "Move to previous symbolic link line"))
(define-key map [menu-bar immediate create-directory]
'(menu-item "Create Directory..." dired-create-directory
:help "Create a directory"))
@@ -2431,6 +2439,23 @@ dired-prev-dirline
(interactive "p")
(dired-next-dirline (- arg)))
+(defun dired-next-symlinkline (arg &optional opoint)
+ "Goto ARGth next symbolic link file line."
+ (interactive "p")
+ (or opoint (setq opoint (point)))
+ (if (if (> arg 0)
+ (re-search-forward dired-re-sym nil t arg)
+ (beginning-of-line)
+ (re-search-backward dired-re-sym nil t (- arg)))
+ (dired-move-to-filename) ; user may type `i' or `f'
+ (goto-char opoint)
+ (error "No more symlinks")))
+
+(defun dired-prev-symlinkline (arg)
+ "Goto ARGth previous symbolic link file line."
+ (interactive "p")
+ (dired-next-symlinkline (- arg)))
+
(defun dired-up-directory (&optional other-window)
"Run Dired on parent directory of current directory.
Find the parent directory either in this buffer or another buffer.
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
of 2020-08-19 built on localhost.example.com
Repository revision: 88795c52ff13203dda5940ed5defc26ce2c20e5e
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: openSUSE Tumbleweed
next reply other threads:[~2020-08-24 19:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 19:12 Tino Calancha [this message]
2020-08-24 22:36 ` bug#43028: 28.0.50; Add dired commands to navigate symbolic links 積丹尼 Dan Jacobson
2020-08-25 8:29 ` Lars Ingebrigtsen
2020-08-25 15:44 ` Tino Calancha
2020-08-25 19:55 ` Lars Ingebrigtsen
2020-08-25 20:17 ` Drew Adams
2020-08-27 8:14 ` Tino Calancha
2020-08-27 8:17 ` Tino Calancha
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wo1noo2u.fsf@gmail.com \
--to=tino.calancha@gmail.com \
--cc=43028@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=uyennhi.qm@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).