Skip to content

Instantly share code, notes, and snippets.

@dfeich
dfeich / dfeich-hydras.el
Created May 10, 2018
Context specific Hydra launcher and some hydras used in it
View dfeich-hydras.el
;;; ** Hydras
;;; *** context launcher for hydras
(defun dfeich/context-hydra-launcher ()
"A launcher for hydras based on the current context."
(interactive)
(cl-case major-mode
('org-mode (let* ((elem (org-element-context))
(etype (car elem))
(type (org-element-property :type elem)))
(cl-case etype
@dfeich
dfeich / dfeich-ansi-terminal.el
Created Mar 16, 2017
Emacs function to open an ansi-term at a local or remote location
View dfeich-ansi-terminal.el
(defun dfeich/ansi-terminal (&optional path name)
"Opens an ansi terminal at PATH. If no PATH is given, it uses
the value of `default-directory'. PATH may be a tramp remote path.
The ansi-term buffer is named based on `name' "
(interactive)
(unless path (setq path default-directory))
(unless name (setq name "ansi-term"))
(ansi-term "/bin/bash" name)
(let ((path (replace-regexp-in-string "^file:" "" path))
(cd-str
@dfeich
dfeich / dfeich-gnome-term.el
Last active Nov 23, 2018
Emacs function to open a gnome-terminal at location of default-directory (handles remote locations)
View dfeich-gnome-term.el
(defun dfeich/gnome-terminal (&optional path)
"Opens a gnome terminal at PATH. If no PATH is given, it uses
the value of `default-directory'. PATH may be a tramp remote path."
(interactive)
(unless path (setq path default-directory))
(if (tramp-tramp-file-p path)
(let ((tstruct (tramp-dissect-file-name path)))
(cond
((equal (tramp-file-name-method tstruct) "ssh")
(call-process "/usr/bin/gnome-terminal" nil nil nil
You can’t perform that action at this time.