Skip to content

Instantly share code, notes, and snippets.

(defun callit (fun)
(message "Value: %S" (funcall fun)))
(dolist (foo '(1 2 3))
(callit (lambda ()
foo)))
#!/bin/sh
# check.sh origin
#
# This will fetch commits from origin, and then display the log of
# changes from origin back to when it first deviated from the current
# branch.
if [ -z "$1" ]
then
@jorgenschaefer
jorgenschaefer / gist:3854597
Created October 8, 2012 19:58
sontek's special backspace
(defun sontek-delete-multiple-spaces-or-normal-backspace ()
(interactive)
(if (looking-back " ")
(delete-backward-char 4)
(delete-backward-char 1)))
(defsubst url-port (urlobj)
"Return the port number for the URL specified by URLOBJ."
(declare (gv-setter (lambda (port) `(setf (url-portspec ,urlobj) ,port))))
(or (url-portspec urlobj)
(defun tracking-ignored-p (buffer faces)
"Return non-nil when BUFFER with FACES shouldn't be tracked.
This uses `tracking-ignored-buffers'. Actual returned value is
the entry from tracking-ignored-buffers that causes this buffer
to be ignored."
(catch 'return
(let ((buffer-name (buffer-name buffer)))
(dolist (entry tracking-ignored-buffers)
(if (stringp entry)
(and (string-match entry buffer-name)
;;;;;;;;;;;;;;;;;
;;; markdown-mode
(when (require 'markdown-mode nil t)
(setq markdown-command "markdown_py"
markdown-italic-underscore t
markdown-indent-on-enter nil
markdown-follow-wiki-link-on-enter nil
)
(add-to-list 'auto-mode-alist '("\\.md" . markdown-mode))
(defun hash-items (tab)
(let ((r nil))
(maphash (lambda (k v)
(setq r (cons (cons k v) r)))
tab)
r))
(defun search-word-at-point ()
"Search and move point to the next occurrence of the word at point."
(interactive)
;; This code is a bit more complex than it should be, mainly to get
;; the "intuitive" result in all cases. `thing-at-point' does not,
;; for example.
(let (beg end word found)
(setq start (point))
(save-excursion
(cond
(defun search-symbol-at-point ()
"Search and move point to the next occurrence of the symbol at point."
(interactive)
;; This code is a bit more complex than it should be, mainly to get
;; the "intuitive" result in all cases. `thing-at-point' does not,
;; for example.
(let (beg end symbol found)
(setq start (point))
(save-excursion
(cond
(defun lui-scroll-window (window display-start)
"Scroll the input line to the bottom of the WINDOW.
DISPLAY-START is passed by the hook `window-scroll-functions' and
is ignored.
See `lui-scroll-behavior' for how to customize this."
(when (and (eq lui-scroll-behavior 'post-scroll)
window
(window-live-p window))