Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;; Time-stamp: <2015-02-18 11:11:07 kmodi>
;; hydra issue #37
;; GNU Emacs (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4)
;; of 2015-02-17
;; Global variables (symbols)
(setq user-home-directory (getenv "HOME"))
(setq user-emacs-directory (concat user-home-directory "/.emacs.d"))
(setq my/temp-directory (concat user-emacs-directory "/temp/hydra_issue_37"))
(defun prepend-path ( my-path )
(setq load-path (cons (expand-file-name my-path) load-path)))
(unless (file-exists-p my/temp-directory)
(make-directory my/temp-directory))
;; Download hydra
(unless (file-exists-p (concat my/temp-directory "/hydra"))
(shell-command (concat
"git clone "
(prepend-path (concat my/temp-directory "/hydra"))
(require 'hydra)
(defun endless/comment-line-or-region (n)
"Comment or uncomment current line and proceed to the next line.
With positive prefix, apply to N lines including current one.
With negative prefix, apply to -N lines above.
If region is active, apply to active region instead."
(interactive "p")
(if (use-region-p)
(region-beginning) (region-end))
(let ((range
(list (line-beginning-position)
(goto-char (line-end-position n)))))
(apply #'min range)
(apply #'max range)))
(forward-line 1)
(defhydra hydra-test-issue-37 (:color blue)
("u" upcase-region "upcase") ; works
("l" downcase-region "downcase") ; works
(";" endless/comment-line-or-region "comment") ; DOES NOT WORK
("q" nil "cancel" :color blue))
(global-set-key (kbd "M-c") #'hydra-test-issue-37/body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.