unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
@ 2020-08-24 19:12 Tino Calancha
  2020-08-24 22:36 ` 積丹尼 Dan Jacobson
  2020-08-25  8:29 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Tino Calancha @ 2020-08-24 19:12 UTC (permalink / raw)
  To: 43028; +Cc: uyennhi.qm, jidanni

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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-24 19:12 bug#43028: 28.0.50; Add dired commands to navigate symbolic links Tino Calancha
@ 2020-08-24 22:36 ` 積丹尼 Dan Jacobson
  2020-08-25  8:29 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 8+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-08-24 22:36 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 43028, uyennhi.qm

>>>>> "TC" == Tino Calancha <tino.calancha@gmail.com> writes:

TC> How do you feel about adding these new navigators and bind them to
TC> '{' '}' ?

Keen I guess.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-24 19:12 bug#43028: 28.0.50; Add dired commands to navigate symbolic links Tino Calancha
  2020-08-24 22:36 ` 積丹尼 Dan Jacobson
@ 2020-08-25  8:29 ` Lars Ingebrigtsen
  2020-08-25 15:44   ` Tino Calancha
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-25  8:29 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 43028, uyennhi.qm, jidanni

Tino Calancha <tino.calancha@gmail.com> writes:

> How do you feel about adding these new navigators and bind them to
> '{' '}' ?

[...]

> +*** New commands 'dired-prev-symlinkline', 'dired-next-symlinkline' to visit
> +symbolic links in the current dired buffer, bound respectively to '{' '}'.

Hm...  I can't say that I can remember ever wanting to visit symlinks in
a dired buffer in particular.  What's the use case?

And I think that if I wanted to, I probably wouldn't remember these
keystrokes -- I'd just isearch for -> instead.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-25  8:29 ` Lars Ingebrigtsen
@ 2020-08-25 15:44   ` Tino Calancha
  2020-08-25 19:55     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Tino Calancha @ 2020-08-25 15:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43028, Tino Calancha, uyennhi.qm, jidanni



On Tue, 25 Aug 2020, Lars Ingebrigtsen wrote:

> Hm...  I can't say that I can remember ever wanting to visit symlinks in
> a dired buffer in particular.  What's the use case?
Of course, it is of interest if you work a lot with symbolic links: to 
move promptly to them with short typing.
I do use them often, that's why I feel good with this.

Of course, if it is not see as something useful it's OK to 
discard this idea (that's why I wanted to ask first) :-)

> And I think that if I wanted to, I probably wouldn't remember these
> keystrokes -- I'd just isearch for -> instead.
I added the menu entry under 'Immediate' for discoverability.

For american keyboards is almost same exercise push < or > than { or }
Also, the curly braces suggested me some directionability in their shape 
that we haven't exploit yet.
I have noticed dired+ is not using this key either.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-25 15:44   ` Tino Calancha
@ 2020-08-25 19:55     ` Lars Ingebrigtsen
  2020-08-25 20:17       ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-25 19:55 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 43028, uyennhi.qm, jidanni

Tino Calancha <tino.calancha@gmail.com> writes:

> For american keyboards is almost same exercise push < or > than { or }
> Also, the curly braces suggested me some directionability in their
> shape that we haven't exploit yet.

Yeah, they're not much used.  tabulated-list-mode uses them to
widen/narrow columns, for instance, and...   that's all the special-mode
usage of those keys I can remember.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2020-08-25 20:17 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Tino Calancha; +Cc: 43028, uyennhi.qm, jidanni

> Yeah, they're not much used.  tabulated-list-mode uses them to
> widen/narrow columns, for instance, and...   that's all the special-mode
> usage of those keys I can remember.  :-)

Dired uses `M-{' and `M-}' to move among marked files.

Personally, I'd say leave navigation-to-symlinks commands
unbound to keys.  If such navigation becomes popular,
users will bind the commands to keys, and if users ask
for Emacs to bind them by default we can then ask which
keys to use, etc.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-25 20:17       ` Drew Adams
@ 2020-08-27  8:14         ` Tino Calancha
  2020-08-27  8:17         ` Tino Calancha
  1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2020-08-27  8:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: 43028, Lars Ingebrigtsen, uyennhi.qm, jidanni

Drew Adams <drew.adams@oracle.com> writes:

> Dired uses `M-{' and `M-}' to move among marked files.
>
> Personally, I'd say leave navigation-to-symlinks commands
> unbound to keys.  If such navigation becomes popular,
> users will bind the commands to keys, and if users ask
> for Emacs to bind them by default we can then ask which
> keys to use, etc.
I agree.
Thanks all.  I am closing this issue as it turned out to be
too specific for my use cases.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#43028: 28.0.50; Add dired commands to navigate symbolic links
  2020-08-25 20:17       ` Drew Adams
  2020-08-27  8:14         ` Tino Calancha
@ 2020-08-27  8:17         ` Tino Calancha
  1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2020-08-27  8:17 UTC (permalink / raw)
  To: 43028-done


It is not clear that the proposed key bindings are useful
for a broader audience.  Closing the issue as wontfix.







^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-27  8:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 19:12 bug#43028: 28.0.50; Add dired commands to navigate symbolic links Tino Calancha
2020-08-24 22:36 ` 積丹尼 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

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).