Blog | Mastodon | Github | Gitlab | Sourcehut |
---|
tarsius / keycast Goto Github PK
View Code? Open in Web Editor NEWShow current command and its key in the mode line
License: GNU General Public License v3.0
Show current command and its key in the mode line
License: GNU General Public License v3.0
Blog | Mastodon | Github | Gitlab | Sourcehut |
---|
Hi,
I noticed that keycast will stop working after evaluating (password-read "Password prompt: ")
,
but it can be worked around by doing M-x keycast-mode
twice.
The version I installed is 20210616.826 .
Can you add a variable so that it shows up with the rest of the information in the mode-line?
I use the latest version, and this occurs in the warning list
Hi,
I got (void-variable keycast-window-predicate)
error when using Keycast-Header-Line mode. It seems that this variable is not defined in keycast..
Example:
(password-read "Password prompt: ")
Then type in some chars. In the minibuffer they are shown as *
, but keycast shows the actual keystrokes.
Personally this isn't really an issue, but I can image this is a security concern for some people.
#31 Follow-up
I checked out master and was satisfied with the M-x behavior. Thanks for changes.
With all three choices for keycast-show-minibuffer-exit-command
, I was unable to properly show digit-argument
and universal-argument
. universal-argument-more
will likely be similar. Those are just the commands I was aware of requiring special cases depending on the user's intent.
The blunt approach of recording and comparing values during pre-command-hook and post-command-hook is at the very least haphazardly obtaining correct values for these cases.
I'm a little bit uncomfortable with using explicit key sequences such as M-x
, but possibly I should read more to understand how it is consistent if bindings are customized?
Do you know if universal-argument
and execute-extended-command
interact with the command loop states similarly?
Thanks in advance for further advising changes.
I try to enable keycast mode. However I am getting this error:
helm-M-x-execute-command: Cannot turn on keycast-mode. mode-line-buffer-identification not found in mode-line-format. Try customizing keycast-insert-after.
emacs 29.3 on macos
custom-initialize-reset: Cannot turn on keycast-mode-line-mode. mode-line-end-spaces not found in mode-line-format. Try customizing keycast-mode-line-insert-after.
config sample:
(use-package keycast
:straight t
:hook (after-init . keycast-mode-line-mode)
:config
(setq keycast-mode-line-format "%5s%K%C%r")
(setq keycast-mode-line-remove-tail-elements nil)
(setq keycast-mode-line-insert-after 'mode-line-end-spaces))
or
(use-package keycast
:straight t
:config
(keycast-mode-line-mode)
(define-minor-mode keycast-mode
"Keycast mode"
:global t
(if keycast-mode
(progn
(add-to-list 'global-mode-string '("" keycast-mode-line " "))
(add-hook 'pre-command-hook 'keycast--update t) )
(remove-hook 'pre-command-hook 'keycast--update)
(setq global-mode-string (delete '("" keycast-mode-line " ") global-mode-string)))))
Using keycast with moody or doom-modeine give the following errors respectively:
Error (use-package): keycast/:config: Cannot turn on keycast-mode. mode-line-buffer-identification not found in mode-line-format
user-error: Cannot turn on keycast-mode. mode-line-buffer-identification not found in mode-line-format
Can it even work with those modelines?
Hi!
keycast
could not find mode-line-buffer-identification
after eldoc enabled.
eldoc
attempt to show information in modeline when using echo-area such as C-: (eval-expression)
.
In eldoc-minibuffer-message
, the previous values are placed at a deeper level to keep the previous values as a list.
As a result, keycast
fails to find the desired symbol and cannot enable keycast-mode
.
C-:
mode-line-format
;;=> ("%e"
;; mode-line-front-space
;; mode-line-mule-info
;; mode-line-client
;; mode-line-modified
;; mode-line-remote
;; mode-line-frame-identification
;; mode-line-buffer-identification
;; " "
;; mode-line-position
;; (vc-mode vc-mode)
;; " " mode-line-modes mode-line-misc-info mode-line-end-spaces)
C-:
mode-line-format
;;=> (""
;; (eldoc-mode-line-string
;; (" " eldoc-mode-line-string " "))
;; ("%e"
;; mode-line-front-space
;; mode-line-mule-info
;; mode-line-client
;; mode-line-modified
;; mode-line-remote
;; mode-line-frame-identification
;; mode-line-buffer-identification
;; " "
;; mode-line-position
;; (vc-mode vc-mode)
;; " " mode-line-modes mode-line-misc-info mode-line-end-spaces))
That's not the image that's supposed to be displayed here.
Hello Jonas! I noticed that the Emacs 28 mode-line-compact
variable has a negative effect on keycast-mode
when it is set to a non-nil value. It trims the spaces/padding of the key indicator and it affects the distance between the key and the command's name.
I replaced regular spaces with non-breaking spaces in keycast--format
, which seems to have fixed the issue. Though you will probably have a better idea.
keycast.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/keycast.el b/keycast.el
index 57742c8..75f6999 100644
--- a/keycast.el
+++ b/keycast.el
@@ -231,12 +231,12 @@
(unless (eq c t) (setq cmd c))))
(and key cmd
(let ((k (let ((pad (max 2 (- 5 (length key)))))
- (concat (make-string (ceiling pad 2) ?\s) key
- (make-string (floor pad 2) ?\s))))
+ (concat (make-string (ceiling pad 2) ? ) key
+ (make-string (floor pad 2) ? ))))
(c (format " %s" cmd)))
(format-spec
format
- `((?s . ,(make-string keycast-separator-width ?\s))
+ `((?s . ,(make-string keycast-separator-width ? ))
(?k . ,(propertize k 'face 'keycast-key))
(?K . ,key)
(?c . ,(propertize c 'face 'keycast-command))
Hello Jonas! I was wondering whether there is some way to filter out self-insert-command
from keycast-log-mode
. I think that would make the overall log cleaner.
For keycast-mode
we can do something like:
(setq keycast-substitute-alist
'((org-self-insert-command "." "Typing...")
(self-insert-command "." "Typing...")))
It is effective because we only ever see one entry at a time. But this will not look good in the log's buffer.
So here is a proof-of-concept:
keycast.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/keycast.el b/keycast.el
index 714c402..daaa00c 100644
--- a/keycast.el
+++ b/keycast.el
@@ -344,7 +344,9 @@ (defun keycast-log-update-buffer ()
(with-current-buffer buf
(goto-char (if keycast-log-newest-first (point-min) (point-max)))
(let ((inhibit-read-only t))
- (insert (keycast--format keycast-log-format)))
+ (unless (or (eq this-command 'self-insert-command)
+ (eq this-command 'org-self-insert-command))
+ (insert (keycast--format keycast-log-format))))
(goto-char (if keycast-log-newest-first (point-min) (point-max)))))))
(defun keycast-log-erase-buffer ()
Perhaps there can be a defcustom
that controls this behaviour, or you may have some cleaner way to approach this.
What do you think?
I'm trying to integrate keycast with spaceline, and to do so I'm creating a spaceline segment for keycast. Problem is keycast-mode won't activate unless I set keycast-insert-after
to something... which I don't see any point in doing so because spacelines just going to override it anyways.
So I propose enable the mode, assign the hooks and just don't add to the mode line if the user hasn't specified a location to add it to.
Hi, the default config records every command. Is it possible to ignore some of them? For example, people might not need to record mouse-related commands or self-insert-command
. Thank you.
Hi,
Thanks for this package, it's great for presenting/live coding in front of an audience!
I noticed that sometimes I am unable to disable keycast-mode. What happens is that the mode is disabled, but the actual keycasting is just frozen on the last command. I'm not 100% sure yet how to isolate this problem, but I have a hunch that it may be related to a lost display connection - I run an emacs daemon, and when there is a hiccup with the connection I may have to reconnect to the emacsclient
(after which keycast-mode is stuck and I need to restart emacs).
I will update this issue once I'm sure exactly what the problem is/how to reproduce.
How disable keycast-log-mode.
I can't kill the keycast new buffer that the frame I run keycast-log-mode.
Hi!
Thanks for looking into this as I'm not sure whether this is a bug or by design but this is the behaviour on my Emacs 29.2.
Basically, if (:eval)
is used, then the keycast is inserted both at the beginning of the mode line and after the specified keycast-mode-line-insert-after
. Without (:eval)
, it works as expected.
I understand in my little example, (:eval)
is not needed but it may be used in a more complex configuration.
(use-package package
:custom
(package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("stable" . "https://stable.melpa.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-archive-priorities
'(("gnu" . 3)
("nongnu" . 2)
("stable" . 1)
("melpa" . 0))))
(use-package keycast
:ensure t
:pin melpa
:custom
(keycast-mode-line-format "%k%c%R")
(keycast-mode-line-remove-tail-elements nil)
:bind
("C-c k" . keycast-mode-line-mode))
;; keycast is only inserted after mode-line-buffer-identification
(setq-default mode-line-format
'("%e"
mode-line-buffer-identification))
;; keycast is also inserted after the beginning of mode line
(setq-default mode-line-format
'(:eval
'("%e"
mode-line-buffer-identification)))
Hi, keycast only supports the mode-line right now. But it is also possible to use the header-line in place of the mode line.
Example: https://github.com/rougier/nano-modeline
(Otherwise, one can set header-line-format
to mode-line-format
(with other necessary changes) and turn on global-hide-mode-line-mode
to get the "mode line" at the top of the window.)
It is not possible to use keycast when the global-hide-mode-line-mode
and the header-line
is active. Support for the header-line with a flag to specify the same would be super.
eg.
(setq keycast-mode-line-format #'my-keycast-mode-line-format)
(defun my-keycast-mode-line-format (key cmd)
(concat key " | " command))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.