-
-
Notifications
You must be signed in to change notification settings - Fork 252
Emacs Help Mode #2240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
VisenDev
wants to merge
14
commits into
lem-project:main
Choose a base branch
from
VisenDev:describe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Emacs Help Mode #2240
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2c32b3b
add a variable for overriding the describe output medium
VisenDev 2271ab9
minor fixes
VisenDev fad63fb
get basic bindings working
VisenDev ee5f8d8
change the describe output type when using emacs help mode
VisenDev 42d7d67
add an initial implementation of apropos-variable (describe variable)
VisenDev d87a5f2
clean up some docs and exports
VisenDev 126c549
refactor code to use the call-with-* pattern
VisenDev b06191c
Merge branch 'main' into describe
VisenDev 9909e0f
I realized minor mode keymap can shadow global bindings which is what…
VisenDev a90643b
Remove superfluous parameter
VisenDev ce85290
begin fixing issues identified in code review
VisenDev 16eecab
Remove caching
VisenDev dffa0a2
Add error check
VisenDev 303f11b
fix compile error
VisenDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| (in-package #:asdf-user) | ||
|
|
||
| (defsystem "lem-emacs-help-mode" | ||
| :description "Emacs Style Help Keybindings for Lem" | ||
| :author "Robert Wess Burnett" | ||
| :license "MIT" | ||
| :depends-on ("lem/core") | ||
| :serial t | ||
| :components ((:file "main"))) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| (defpackage #:lem-emacs-help-mode | ||
| (:use #:cl #:lem)) | ||
| (in-package #:lem-emacs-help-mode) | ||
|
|
||
| (defvar *emacs-help-mode-keymap* (make-keymap)) | ||
| (defvar *ctrl-h-keymap* (make-keymap)) | ||
| (defvar *previous-describe-output-override* nil) | ||
|
|
||
| (define-key *ctrl-h-keymap* "k" 'describe-key) | ||
| (define-key *ctrl-h-keymap* "b" 'describe-bindings) | ||
| (define-key *ctrl-h-keymap* "m" 'describe-mode) | ||
| (define-key *ctrl-h-keymap* "a" 'apropos-command) | ||
| (define-key *ctrl-h-keymap* "v" 'apropos-variable) | ||
| ;; TODO add describe-function command for "f" | ||
|
|
||
| (define-key *emacs-help-mode-keymap* "C-h" *ctrl-h-keymap*) | ||
|
|
||
| (defun enable () | ||
| "Enables emacs help mode" | ||
|
|
||
| ;; TODO, figure out a more functional way to overwrite this | ||
| ;; variable which does not cause mutable global state | ||
| (setf *previous-describe-output-override* | ||
| lem-core/commands/help:*describe-output-type-override*) | ||
| (setf lem-core/commands/help:*describe-output-type-override* :buffer)) | ||
|
|
||
| (defun disable () | ||
| "Disables emacs help mode" | ||
| (setf lem-core/commands/help:*describe-output-type-override* | ||
| *previous-describe-output-override*) | ||
| (setf *previous-describe-output-override* nil)) | ||
|
|
||
| (define-minor-mode emacs-help-mode | ||
| (:name "EHelp" | ||
| :description "Adds Emacs Style C-h Bindings." | ||
| :global t | ||
| :keymap *emacs-help-mode-keymap* | ||
| :enable-hook 'enable | ||
| :disable-hook 'disable)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary (for end users) to export this variable? You can access it with
::.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do mean Lem users can use it (to have help text in buffers rather than popups for instance), I'd push for a better name.
Also, what about giving prefix arguments to the interactive commands, to change the output type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant for it to be customizable for lem users yes. If you have any better name suggestions I would be happy to hear them, I had a lot of trouble naming this variable.
As to prefix arguments, I'm not sure what would be involved for that, do you mean prefix arguments like how you can do
C-u M-x fooin emacs to give extra arguments for the command?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not easy…
documentation-output?yes I mean prefix arguments like this. The use could be: M-x describe-lem-variables uses the default documentation-output, say the popup. Now calling
C-u 1 M-x …would use a:buffer. (maybe not a great idea, usability-wise)Other idea: to have a command that changes the default output. For ex:
M-x set-documentation-output RET buf <TAB> -> buffer RET-> changes it to :buffer for the current session. And the value could be serialized in Lem's config (a very easy mechanism I can point if you don't know it yet). WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes a
set-documentation-outputcommand sounds like a good idea. I am not familiar with the serialized config mechanism - where should I look to find how to use it?