Skip to content

Instantly share code, notes, and snippets.

@tam17aki
tam17aki / elscreen.el.patch
Last active October 10, 2015 23:08
patch file for elscreen.el
*** elscreen.el 2012-10-03 11:34:53.000000000 +0900
--- elscreen_new.el 2012-10-03 11:35:35.000000000 +0900
***************
*** 37,43 ****
;;; User Customizable Variables:
! (defconst elscreen-version "2012-04-11")
(defgroup elscreen nil
@tam17aki
tam17aki / pophint--get-hints-patch.el
Created August 4, 2013 01:15
narrowing example for pophint--get-hints
(narrow-to-region (save-excursion (or (when (move-to-window-line 1) (point))
(point-min)))
(save-excursion (or (when (move-to-window-line -1) (point))
(point-max))))
@tam17aki
tam17aki / recentf-ido-files-and-dirs.el
Last active December 21, 2015 16:29
Find a recent file and a directory using Ido.File names and directory names are searched with basename and dirname, respectively.
(require 'recentf)
(defun recentf-ido-find-files-and-dirs (arg)
"Find a recent file and a directory using Ido."
(interactive "P")
(let* ((show-full-path-p (cond (arg t) (t nil)))
(file-assoc-list ;表示する候補名とフルパス
(mapcar (lambda (x)
(cond ((equal (substring x (- (length x) 1) (length x)) "/") ;末尾がスラッシュ
(cons (file-name-directory x) x))
(t
(defun ido-smart-select-text-throw ()
(let ((match (ido-name (car ido-matches))))
(throw 'ido
(setq ido-selected
(if match
(replace-regexp-in-string "/\\'" "" match)
ido-text)
ido-text ido-selected
ido-final-text ido-text))))
(defun ido-smart-select-text ()
(require 'cl-lib)
(cl-defun ido-choose-visible-window ()
"ウィンドウ切り替えをido補完で.選択中のウィンドウは切り替え候補から外す."
(interactive)
(let ((alist (mapcar (lambda (win)
(cons (buffer-name (window-buffer win))
win))
(remove (selected-window)
(window-list))))
result)
(defun ibuffer-ido-find-file ()
"Like `ido-find-file', but default to the directory of the buffer at point."
(interactive)
(let ((default-directory
(let ((buf (ibuffer-current-buffer)))
(if (buffer-live-p buf)
(with-current-buffer buf
default-directory)
default-directory))))
(ido-find-file-in-dir default-directory)))
(require 'smartchr nil t)
(defun smartchr-braces ()
"Insert a pair of braces like below.
\n {\n `!!'\n}"
;; foo {
;; `!!'
;; }
(lexical-let (beg end)
(smartchr-make-struct
(defun iedit-dwim-get-string ()
(cond ((iedit-region-active)
(setq mark-active nil)
(run-hooks 'deactivate-mark-hook)
(buffer-substring-no-properties
(region-beginning) (region-end)))
(t
(current-word))))
(defun iedit-dwim (arg)
"Starts iedit but uses \\[narrow-to-defun] to limit its scope."
(lazyload (highlight-symbol-all
highlight-symbol-moccur
highlight-symbol-occur-by-moccur) "highlight-symbol" nil
(defun highlight-symbol-all (&optional nlines)
"Use all for highlighted symbols."
(interactive "P")
(if (thing-at-point 'symbol)
(all (highlight-symbol-get-symbol) nlines)
(error "No symbol at point.")))
(require 'ace-jump-mode)
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
(defun add-keys-to-ace-jump-mode (prefix c &optional mode)
(define-key global-map
(read-kbd-macro (concat prefix (string c)))
`(lambda ()
(interactive)
(funcall (if (eq ',mode 'word)
#'ace-jump-word-mode