Skip to content

Instantly share code, notes, and snippets.

View v2e4lisp's full-sized avatar

Yan Wenjun v2e4lisp

View GitHub Profile
(defun adapt-minimap-to-current-buffer ()
(interactive)
(when (null minimap-bufname)
(close-all-minimap-buffer)
(minimap-new-minimap)))
(defun close-all-minimap-buffer ()
(interactive)
(let ((windows (window-list)))
@v2e4lisp
v2e4lisp / minimap.el
Last active December 13, 2015 22:29
Put this code in minimap.el . Use iminimap to create file. * todo * make this auto update the minimap buffer once you change your current buffer in the window.
;; -- start playing around -- ;;
(defun minimap-reset ()
(interactive)
(minimap-delete-window-and-buffer)
(setq minimap-start nil)
(setq minimap-end nil)
(setq minimap-active-overlay nil)
(setq minimap-bufname nil)
(setq minimap-timer-object nil)
(setq minimap-active-minimaps 0)
(defun clear-shell ()
(interactive)
(let ((comint-buffer-maximum-size 0))
(comint-truncate-buffer)))
(define-key shell-mode-map (kbd "C-l") 'clear-shell)
(defun delete-completion-window-buffer (output)
(interactive)
(dolist (win (window-list))
(when (string= (buffer-name (window-buffer win)) "*Completions*")
@v2e4lisp
v2e4lisp / init.el
Created February 22, 2013 16:02
A little function to restart sml. So you don't have to do "C-c C-d " and sml-run. Just isml!
(defun isml ()
(interactive)
(when (get-buffer "*sml*")
(with-current-buffer "*sml*"
(when (process-live-p "sml")
(comint-send-eof)))
(sleep-for 0.1))
(sml-run "sml" ""))
@v2e4lisp
v2e4lisp / misc.el
Created February 28, 2013 00:58
yet another buffer-file-name-body.
(defun ya-buffer-file-name-body ()
"yet-another buffer-file-name-body function. FOR FUN!"
(interactive)
(car (split-string
(car (last (split-string
(buffer-file-name) "/"))) "\\.")))
* html5 game developing
* algorithm
* javascript ninjia
* elisp
(defmacro in (list elem)
" first macro nonsense"
(let ((tempvar (make-symbol "is-in")))
`(flet ((is-in (l e)
(if l (if (= (car l) e) t
(is-in (cdr l) e))
nil)))
(is-in ,list ,elem))))
19.5.1 Content-Disposition
The Content-Disposition response-header field has been proposed as a means for the origin server to suggest a default filename if the user requests that the content is saved to a file. This usage is derived from the definition of Content-Disposition in RFC 1806 [35].
content-disposition = "Content-Disposition" ":"
disposition-type *( ";" disposition-parm )
disposition-type = "attachment" | disp-extension-token
disposition-parm = filename-parm | disp-extension-parm
filename-parm = "filename" "=" quoted-string
disp-extension-token = token
(defun delete-trailing-whitespace-current-buffer ()
(interactive)
(let ((pos (point)))
(replace-regexp "\\(.\\)[ \t]+$" "\\1")
(goto-char pos)))