Skip to content
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

Empty string in the hydra docstring returns error #291

Closed
sewkokot opened this issue Jun 29, 2018 · 3 comments
Closed

Empty string in the hydra docstring returns error #291

sewkokot opened this issue Jun 29, 2018 · 3 comments

Comments

@sewkokot
Copy link

Why evaluating the following code gives an error? In some cases there is no need for redundant docstring when e.g. :column "docstring1" is provided. Also as a work-around I could set " " as the docstring but still I have " :" (space + colon) in the minibuffer. I looked at the hydra.el code but could not figure out where the colon is hard-coded? What i can do in this situation?

(defhydra hydra-clock (:color blue)
  ""
  ("q" nil "quit" :column "Clock")
  ("c" org-clock-cancel "cancel" :color pink :column "Do")
  ("d" org-clock-display "display")
  ("e" org-clock-modify-effort-estimate "effort")
  ("i" org-clock-in "in")
  ("j" org-clock-goto "jump")
  ("o" org-clock-out "out")
  ("r" org-clock-report "report"))

Debugger entered--Lisp error: (args-out-of-range "" 0)
aref("" 0)
(eq 10 (aref docstring 0))
(if (eq 10 (aref docstring 0)) (list (quote concat) (cons (quote format) (cons (substring docstring 1) (nreverse varlist))) rest) (let ((r (list (quote replace-regexp-in-string) " +$" "" (list (quote concat) docstring ": " (list (quote replace-regexp-in-string) "\(%\)" "\1\1" rest))))) (if (stringp rest) (list (quote format) (eval r)) (list (quote format) r))))

@sewkokot
Copy link
Author

sewkokot commented Jul 2, 2018

I found where the colon after 'docstring' is hard-coded. The problem was that I have hydra package from melpa and local hydra from github. I removed the colon in hydra.el from local git, but hydra from melpa directory had been loaded first and the colon persisted. Anyway I left the colon as it is and now I use the newline as the docstring

(defhydra hydra-clock (:color blue)
  "
"
  ("q" nil "quit" :column "Exit")
  ("c" org-clock-cancel "cancel" :color pink :column "Clock")
...
  ("r" org-clock-report "report"))

I would be happy to see a new feature that if an empty string "" is used as docstring then the docstring in the minibuffer is omitted.

@abo-abo abo-abo closed this as completed in 87cc74b Jul 3, 2018
@abo-abo
Copy link
Owner

abo-abo commented Jul 3, 2018

Thanks, your example should now work like this:

(defhydra hydra-clock (:color blue)
  ("q" nil "quit" :column "Clock")
  ("c" org-clock-cancel "cancel" :color pink :column "Do")
  ("d" org-clock-display "display")
  ("e" org-clock-modify-effort-estimate "effort")
  ("i" org-clock-in "in")
  ("j" org-clock-goto "jump")
  ("o" org-clock-out "out")
  ("r" org-clock-report "report"))

@sewkokot
Copy link
Author

sewkokot commented Jul 3, 2018

Thank you very much, it works as I expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants