all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: 55393@debbugs.gnu.org
Subject: bug#55393: describe-keymap: suggest symbol at point
Date: Fri, 13 May 2022 10:54:12 +0530	[thread overview]
Message-ID: <87lev60zur.fsf@gmail.com> (raw)
In-Reply-To: <87pmki13i2.fsf@gmail.com> (Visuwesh's message of "Fri, 13 May 2022 09:35:25 +0530")

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

[வெள்ளி மே 13, 2022] Visuwesh wrote:

> Tags: patch
>
> describe-keymap differs from other describe-* commands in that it does
> not suggest the symbol at point which always annoyed me.  This patch
> makes describe-keymap consider the symbol at point first.
>
> [ I hope it is okay to use if-let family of macros in these files now?  ]
>
>
>
>
> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
> Repository revision: ca3858563c7ba8ee3caa82fbd2b7c386ea60c0d3
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
> System Description: NixOS 21.11 (Porcupine)
>
> Configured using:
>  'configure
>  --prefix=/nix/store/iqqk7iqfwmfc6r78xg2knyq7hww2mhs4-emacs-git-20220225.0
>  --disable-build-details --with-modules --with-x-toolkit=lucid
>  --with-xft --with-cairo --with-native-compilation'

Turns out I did not git pull master properly so that patch was against
an old master.  Updated patch attached here,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-describe-keyap-Suggest-symbol-at-point.patch --]
[-- Type: text/x-patch, Size: 2324 bytes --]

From 1911ea3d4963bc945953886fb625db6c838f19cb Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Fri, 13 May 2022 10:52:09 +0530
Subject: [PATCH] describe-keyap: Suggest symbol at point

* lisp/help-fns.el (help-fns--most-relevant-active-keymap): Suggest
the symbol at point if it is a keymap.
* etc/NEWS: Announce the change.
---
 etc/NEWS         |  5 +++++
 lisp/help-fns.el | 19 ++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e09834c..54647b8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -562,6 +562,11 @@ minor modes are listed after the major mode.
 The apropos commands will now select the apropos window if
 'help-window-select' is non-nil.
 
+---
+*** 'describe-keymap' now considers the symbol at point
+'describe-keymap' suggests the symbol at point as the default candidate
+if it is a keymap.
+
 ** Outline Mode
 
 +++
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 927a4f0..2636ba9 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1884,16 +1884,21 @@ variable with value KEYMAP."
 The heuristic to determine which keymap is most likely to be
 relevant to a user follows this order:
 
-1. 'keymap' text property at point
-2. 'local-map' text property at point
-3. the `current-local-map'
+1. symbol at point
+2. 'keymap' text property at point
+3. 'local-map' text property at point
+4. the `current-local-map'
 
 This is used to set the default value for the interactive prompt
 in `describe-keymap'.  See also `Searching the Active Keymaps'."
-  (help-fns-find-keymap-name (or (get-char-property (point) 'keymap)
-                         (if (get-text-property (point) 'local-map)
-                             (get-char-property (point) 'local-map)
-                           (current-local-map)))))
+  (if-let ((sym (symbol-at-point))
+           (sym (when sym (intern-soft sym)))
+           (keymapp (ignore-errors (symbol-value sym))))
+      sym
+    (help-fns-find-keymap-name (or (get-char-property (point) 'keymap)
+                           (if (get-text-property (point) 'local-map)
+                               (get-char-property (point) 'local-map)
+                             (current-local-map))))))
 
 (defvar keymap-name-history nil
   "History for input to `describe-keymap'.")
-- 
2.33.1


  reply	other threads:[~2022-05-13  5:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13  4:05 bug#55393: describe-keymap: suggest symbol at point Visuwesh
2022-05-13  5:24 ` Visuwesh [this message]
2022-05-13  6:23 ` Eli Zaretskii
2022-05-13  6:35   ` Visuwesh
2022-05-13  6:51     ` Eli Zaretskii
2022-05-13  7:42       ` Visuwesh
2022-05-13 12:06         ` Eli Zaretskii
2022-05-13 12:47           ` Visuwesh
2022-05-15  5:26             ` Eli Zaretskii
2022-05-15  5:48               ` Visuwesh
2022-05-15  6:19                 ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lev60zur.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=55393@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.