Skip to content

Instantly share code, notes, and snippets.


Greg Lucas glucas

View GitHub Profile
View gist:309fe3d43bd9cf00533f
(defun my/fix-space ()
"Delete all spaces and tabs around point, leaving one space except at the beginning of a line."
(when (looking-back "^[[:space:]]+") (delete-horizontal-space)))
(defun my/delete-backward ()
"When there is an active region, delete it and then fix up the whitespace."
(when (use-region-p)
glucas / gist:09aea018251cf85c7290
Last active August 29, 2015 14:15
View gist:09aea018251cf85c7290
(defun ace-command-other-window (cmd &optional one-win-cmd)
"Execute CMD in another window.
If provided, call ONE-WIN-CMD instead when there is only one window."
(interactive "CM-x (other window) ")
(catch 'done
(when (and one-win-cmd
(not (window-parent)))
(call-interactively one-win-cmd)
(throw 'done t))
(let ((start-window (selected-window))

Keybase proof

I hereby claim:

  • I am glucas on github.
  • I am glucas ( on keybase.
  • I have a public key whose fingerprint is ABF8 9DF2 6AC9 D152 72E8 81A0 7934 B82B D272 9051

To claim this, I am signing this object:

glucas / gist:6730692
Created September 27, 2013 15:45
Elisp snippets for defining ibuffer filter groups for all known projectile projects.
View gist:6730692
(defun my/define-projectile-filter-groups ()
(when (boundp 'projectile-known-projects)
(setq my/project-filter-groups
(--map (list
(concat "Project: " (file-name-nondirectory (directory-file-name it)))
`(filename . ,it))
View rejeep-projectile-completion-fn.el
(defun rejeep-projectile-completion-fn (prompt choises)
"Projectile completion function that only shows file name.
If two files have same name, new completion appears to select between
them. These include the path relative to the project root."
(let* ((stripped-choises
(-uniq (--map (file-name-nondirectory it) choises)))
(ido-completing-read prompt stripped-choises))
glucas / gist:4506530
Created January 10, 2013 22:56
Jumping to the most recent buffer.
View gist:4506530
(defalias 'last-buffer 'mode-line-other-buffer)
(global-set-key (kbd "M-O") 'last-buffer)
(defun my/split-window()
"Split the window to see the most recent buffer in the other window.
Call a second time to restore the original window configuration."
(if (eq last-command 'my/split-window)