-
Notifications
You must be signed in to change notification settings - Fork 23
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
An attempt to fix #75 #76
base: master
Are you sure you want to change the base?
Conversation
This should interest people tracking #75 (and the reference in the title apparently didn't trigger a notification) |
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.
This looks good to me--with the caveat that I don't use Outshine speed commands (I do use Org speed commands), so I'm probably not a good judge of functionality here. Thanks for your work on this, Thibault!
(and | ||
outshine-use-speed-commands | ||
(outline-on-heading-p) | ||
(>= (point) (match-beginning 0)) |
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.
It's unclear at first glance where the match data is set that is used here, so it might be good to write this code to not depend on it. At least, it should probably be documented where the match data comes from and in what circumstances this function is intended to be called. :)
|
||
;;;;;;; Outline Navigation | ||
|
||
(outshine-define-key outshine-mode-map (kbd "n") (lambda () (interactive) (outshine-speed-move-safe 'outline-next-visible-heading)) |
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'd suggest either putting these lambdas on multiple lines to make them easier to read, or using a macro to define them more concisely. :)
(lambda () (interactive) (org-priority ?\ )))) | ||
(outshine-run-speed-command-p)) | ||
|
||
(outshine-define-key outshine-mode-map (kbd "1") (lambda (nil) (interactive) |
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.
This lambda formatting is...non-standard... :) (If you haven't tried it, aggressive-indent-mode
works very well for Elisp buffers.)
alphapapa <notifications@github.com> writes:
Hi all,
@alphapapa requested changes on this pull request.
This looks good to me--with the caveat that I don't use Outshine speed
commands (I do use Org speed commands), so I'm probably not a good judge
of functionality here. Thanks for your work on this, Thibault!
I can not give it any testing right now I must admit, but I can try to
answer Thibaults question:
The implementation process of speed commands in outshine was, iirc, very
simple:
1. copy speed commands implementation from org-mode to outshine
2. make it work in outshine (what was necessary to adapt, I do not know
anymore)
Very nice to see that there is active development on this library, which
does seem to be quite popular among emacs programmers. Thanks a lot for
that,Thibault, and for being an active maintainer thanks to alphapapa!
Cheers
Thorsten
… ------------------------------------------------------------------------
In outshine.el:
> @@ -2440,10 +2155,181 @@ marking subtree (and subsequently run the tex command)."
(define-key outshine-mode-map
[M-down] 'outline-next-visible-heading)
-;;;;; Other Keybindings
-;; refer to Key Bindings section in outshine-org-cmds.el
+;;;;;; Speed commands
+
+(defun outshine-run-speed-command-p ()
+ (and
+ outshine-use-speed-commands
+ (outline-on-heading-p)
+ (>= (point) (match-beginning 0))
It's unclear at first glance where the match data is set that is used
here, so it might be good to write this code to not depend on it. At
least, it should probably be documented where the match data comes from
and in what circumstances this function is intended to be called. :)
------------------------------------------------------------------------
In outshine.el:
> @@ -2440,10 +2155,181 @@ marking subtree (and subsequently run the tex command)."
(define-key outshine-mode-map
[M-down] 'outline-next-visible-heading)
-;;;;; Other Keybindings
-;; refer to Key Bindings section in outshine-org-cmds.el
+;;;;;; Speed commands
+
+(defun outshine-run-speed-command-p ()
+ (and
+ outshine-use-speed-commands
+ (outline-on-heading-p)
+ (>= (point) (match-beginning 0))
+ (<= (point) (match-end 0))
+ (if (functionp outshine-use-speed-commands) (funcall outshine-use-speed-commands) t)))
+
+;;;;;;; Outline Navigation
+
+(outshine-define-key outshine-mode-map (kbd "n") (lambda () (interactive) (outshine-speed-move-safe 'outline-next-visible-heading))
I'd suggest either putting these lambdas on multiple lines to make them
easier to read, or using a macro to define them more concisely. :)
------------------------------------------------------------------------
In outshine.el:
> +
+;;;;;;; Meta Data Editing
+
+(outshine-define-key outshine-mode-map (kbd "t") 'outshine-todo
+ (outshine-run-speed-command-p))
+
+(outshine-define-key outshine-mode-map (kbd ",") 'outshine-priority
+ (outshine-run-speed-command-p))
+;; [X]
+(outshine-define-key outshine-mode-map (kbd "0")
+ (lambda (nil) (interactive)
+ '(outshine-use-outorg
+ (lambda () (interactive) (org-priority ?\ ))))
+ (outshine-run-speed-command-p))
+
+(outshine-define-key outshine-mode-map (kbd "1") (lambda (nil) (interactive)
This lambda formatting is...non-standard... :) (If you haven't tried it,
aggressive-indent-mode works very well for Elisp buffers.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
--
cheers,
Thorsten
|
Thanks for the review, and thanks a lot @tj64 for the explanations! On second thought, my solution is bad, and shouldn't be applied. The Correct Way in Emacs to do local keymaps (ie local to some text in the buffer) is with text properties, I'll look into it when I find the time. |
This removes (yay!) speed-commands code and replaces it with an equivalent (I hope) implementation using only
outshine-define-key
. I think it works, but I've never used speed commands, so I don't know.(setq outshine-use-speed-commands t)
, then pressp
,n
,+
or-
at the beginning of an header