Skip to content

Instantly share code, notes, and snippets.

@sje30
Last active June 4, 2020 06:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sje30/c829a271b8b6d6b4f0fd to your computer and use it in GitHub Desktop.
Save sje30/c829a271b8b6d6b4f0fd to your computer and use it in GitHub Desktop.
makefile-eval-current-target
;; This is inspired by Org mode: hitting C-c C-c inside a Makefile
;; rule will run "make TARGET" where TARGET is the name of the current
;; target at point.
;; Stephen Eglen 2016-01-31 GPL applies.
(defun makefile-eval-current-target ()
"Evaluate the current Makefile rule in a *Compile* buffer."
(interactive)
(let ((target (makefile-add-log-defun)))
(if (null target)
(message "No target could be found.")
(compile (format "make -k %s" target)))))
(add-hook 'makefile-mode-hook
'(lambda () (define-key makefile-mode-map
"\C-c\C-c" 'makefile-eval-current-target)))
(defun yank-url-from-chrome ()
"Grab the current URL from Chrome and yank into point."
(interactive)
(shell-command
"xdotool search --onlyvisible --class Chrome windowfocus key ctrl+l key ctrl+c")
(shell-command
"xdotool search --onlyvisible --class Emacs windowfocus key ctrl+y"))
(defalias 'yu 'yank-url-from-chrome)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment