Skip to content

Latest commit

 

History

History
75 lines (63 loc) · 2.43 KB

starter-kit-defuns.org

File metadata and controls

75 lines (63 loc) · 2.43 KB

Starter Kit Defuns

This is part of the Emacs Starter Kit.

The starter-kit-coding-hook:

A single hook holding those functions which should be run in every code buffer.

We have a number of turn-on-* functions since it’s advised that lambda functions not go in hooks. Repeatedly evaling an add-to-list with a hook value will repeatedly add it since there’s no way to ensure that a lambda doesn’t already exist in the list.

(defun starter-kit-local-column-number-mode ()
  (make-local-variable 'column-number-mode)
  (column-number-mode t))

(defun starter-kit-local-comment-auto-fill ()
  (set (make-local-variable 'comment-auto-fill-only-comments) t)
  (auto-fill-mode t))

(defun starter-kit-turn-on-save-place-mode ()
  (setq save-place t))

(defun starter-kit-turn-on-whitespace ()
  (whitespace-mode t))
(add-hook 'starter-kit-coding-hook 'starter-kit-local-column-number-mode)
(add-hook 'starter-kit-coding-hook 'starter-kit-local-comment-auto-fill)
(when (window-system)
  (add-hook 'starter-kit-coding-hook 'starter-kit-pretty-lambdas))
(defun run-starter-kit-coding-hook ()
  "Enable things that are convenient across all coding buffers."
  (run-hooks 'starter-kit-coding-hook))
(defun recentf-ido-find-file () 
  "Find a recent file using Ido." 
  (interactive) 
  (let* ((file-assoc-list 
          (mapcar (lambda (x) 
                    (cons (file-name-nondirectory x) 
                          x)) 
                  recentf-list)) 
         (filename-list 
          (remove-duplicates (mapcar #'car file-assoc-list) 
                             :test #'string=)) 
         (filename (ido-completing-read "Choose recent file: " 
                                        filename-list 
                                        nil 
                                        t))) 
    (when filename 
      (find-file (cdr (assoc filename 
                             file-assoc-list))))))