unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode
@ 2022-07-02 19:07 Stefan Kangas
  2022-07-03 12:34 ` Lars Ingebrigtsen
  2022-07-03 12:41 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Kangas @ 2022-07-02 19:07 UTC (permalink / raw)
  To: 56360

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Severity: wishlist

I think the navigation commands in `emacs-news-mode' and
'emacs-news-view-mode-map' should be similar to `org-mode' and
`outline-mode'.  IMO, the parts where they agree is the closest we have
anything resembling a "standard" for navigating an outline in Emacs.
See the attached patch.

It is worth comparing to:

    (describe-keymap 'outline-mode-prefix-map)
    (describe-keymap 'outline-navigation-repeat-map)
    (describe-keymap 'org-mode-map)

[-- Attachment #2: 0001-Improve-navigation-keybindings-in-emacs-news-mode.patch --]
[-- Type: text/x-diff, Size: 1855 bytes --]

From 501a2e307d941783b414eb26ad977d4bfde6fd78 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sat, 2 Jul 2022 20:08:15 +0200
Subject: [PATCH] Improve navigation keybindings in emacs-news-mode

* lisp/textmodes/emacs-news-mode.el (emacs-news-common-map): New
defvar-keymap.  Bind navigation commands as in 'org-mode' and
'outline-minor-mode'.
(emacs-news-mode-map): Inherit from 'emacs-news-common-map'.
(emacs-news-view-mode-map): New defvar-keymap; inherit from
'emacs-news-common-map'.
---
 lisp/textmodes/emacs-news-mode.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el
index fdb3cb8628..c6b352448c 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -39,12 +39,24 @@ emacs-news-does-not-need-documentation
   "Face used for displaying the \"does not need documentation\" tag."
   :version "29.1")
 
+(defvar-keymap emacs-news-common-map
+  ;; Navigation like `org-mode'/`outline-minor-mode'.
+  "C-c C-f" #'outline-forward-same-level
+  "C-c C-b" #'outline-backward-same-level
+  "C-c C-n" #'outline-next-visible-heading
+  "C-c C-p" #'outline-previous-visible-heading
+  "C-c C-u" #'outline-up-heading)
+
 (defvar-keymap emacs-news-mode-map
+  :parent emacs-news-common-map
   "C-c C-s" #'emacs-news-next-untagged-entry
   "C-c C-r" #'emacs-news-previous-untagged-entry
   "C-c C-g" #'emacs-news-goto-section
-  "C-c C-f" #'emacs-news-find-heading
-  "C-c C-n" #'emacs-news-count-untagged-entries)
+  "C-c C-j" #'emacs-news-find-heading
+  "C-c C-e" #'emacs-news-count-untagged-entries)
+
+(defvar-keymap emacs-news-view-mode-map
+  :parent emacs-news-common-map)
 
 (defvar emacs-news-mode-font-lock-keywords
   `(("^---$" 0 'emacs-news-does-not-need-documentation)
-- 
2.30.2


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

* bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode
  2022-07-02 19:07 bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode Stefan Kangas
@ 2022-07-03 12:34 ` Lars Ingebrigtsen
  2022-07-03 12:42   ` Stefan Kangas
  2022-07-03 12:41 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-03 12:34 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 56360

Stefan Kangas <stefan@marxist.se> writes:

> I think the navigation commands in `emacs-news-mode' and
> 'emacs-news-view-mode-map' should be similar to `org-mode' and
> `outline-mode'.  IMO, the parts where they agree is the closest we have
> anything resembling a "standard" for navigating an outline in Emacs.
> See the attached patch.

Makes sense to me; go ahead and push.

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





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

* bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode
  2022-07-02 19:07 bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode Stefan Kangas
  2022-07-03 12:34 ` Lars Ingebrigtsen
@ 2022-07-03 12:41 ` Lars Ingebrigtsen
  2022-07-03 12:48   ` Stefan Kangas
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-03 12:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 56360

But leads to these warnings:

In end of data:
textmodes/emacs-news-mode.el:48:15: Warning: the function `outline-up-heading' is not known to be defined.
textmodes/emacs-news-mode.el:47:15: Warning: the function `outline-previous-visible-heading' is not known to be defined.
textmodes/emacs-news-mode.el:46:15: Warning: the function `outline-next-visible-heading' is not known to be defined.
textmodes/emacs-news-mode.el:45:15: Warning: the function `outline-backward-same-level' is not known to be defined.
textmodes/emacs-news-mode.el:44:15: Warning: the function `outline-forward-same-level' is not known to be defined.

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






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

* bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode
  2022-07-03 12:34 ` Lars Ingebrigtsen
@ 2022-07-03 12:42   ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2022-07-03 12:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56360-done

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Makes sense to me; go ahead and push.

Thanks, pushed as commit d68ecda05c.





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

* bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode
  2022-07-03 12:41 ` Lars Ingebrigtsen
@ 2022-07-03 12:48   ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2022-07-03 12:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56360

Lars Ingebrigtsen <larsi@gnus.org> writes:

> In end of data:
> textmodes/emacs-news-mode.el:48:15: Warning: the function `outline-up-heading' is not known to be defined.
> textmodes/emacs-news-mode.el:47:15: Warning: the function `outline-previous-visible-heading' is not known to be defined.
> textmodes/emacs-news-mode.el:46:15: Warning: the function `outline-next-visible-heading' is not known to be defined.
> textmodes/emacs-news-mode.el:45:15: Warning: the function `outline-backward-same-level' is not known to be defined.
> textmodes/emacs-news-mode.el:44:15: Warning: the function `outline-forward-same-level' is not known to be defined.

Thanks, should be fixed now.





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

end of thread, other threads:[~2022-07-03 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-02 19:07 bug#56360: [PATCH] Improve navigation keybindings in emacs-news-mode Stefan Kangas
2022-07-03 12:34 ` Lars Ingebrigtsen
2022-07-03 12:42   ` Stefan Kangas
2022-07-03 12:41 ` Lars Ingebrigtsen
2022-07-03 12:48   ` Stefan Kangas

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