emacs - auto insert template for elisp file
authorPeng Li <seudut@gmail.com>
Sat, 16 Jul 2016 14:00:28 +0000 (22:00 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 16 Jul 2016 14:00:28 +0000 (22:00 +0800)
emacs.d/config.org

index 7d4aa83..adeba50 100644 (file)
@@ -96,7 +96,7 @@ Stop auto save
   (setq auto-save-default nil)
 
   ;; restore last session
-  (desktop-save-mode t)
+  ;; (desktop-save-mode t)
 #+END_SRC
 
 * Package Management Tools
@@ -2013,6 +2013,54 @@ Refer [[https://www.emacswiki.org/emacs/AutoInsertMode][AutoInsertMode]] Wiki
 
 #+END_SRC
 
+*** Elisp 
+Emacs lisp auto-insert, based on the default module in =autoinsert.el=, but replace =completing-read= as 
+=completing-read-ido-ubiquitous= to fix the edge case of that =ido= cannot handle.
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (eval-after-load 'autoinsert
+    '(define-auto-insert '("\\.el\\'" . "my Emacs Lisp header")
+       '(
+         "Short description: "
+         ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str
+         (make-string (max 2 (- 80 (current-column) 27)) ?\s)
+         "-*- lexical-binding: t; -*-" '(setq lexical-binding t)
+         "
+  ;; Copyright (C) " (format-time-string "%Y") "  "
+         (getenv "ORGANIZATION") | (progn user-full-name) "
+  ;; Author: " (user-full-name)
+         '(if (search-backward "&" (line-beginning-position) t)
+              (replace-match (capitalize (user-login-name)) t t))
+         '(end-of-line 1) " <" (progn user-mail-address) ">
+  ;; Keywords: "
+         '(require 'finder)
+         ;;'(setq v1 (apply 'vector (mapcar 'car finder-known-keywords)))
+         '(setq v1 (mapcar (lambda (x) (list (symbol-name (car x))))
+                           finder-known-keywords)
+                v2 (mapconcat (lambda (x) (format "%12s:  %s" (car x) (cdr x)))
+                              finder-known-keywords
+                              "\n"))
+         ((let ((minibuffer-help-form v2))
+            (completing-read-ido-ubiquitous "Keyword, C-h: " v1 nil t))
+          str ", ") & -2 "
+  \;; This program is free software; you can redistribute it and/or modify
+  \;; it under the terms of the GNU General Public License as published by
+  \;; the Free Software Foundation, either version 3 of the License, or
+  \;; (at your option) any later version.
+  \;; This program is distributed in the hope that it will be useful,
+  \;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+  \;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  \;; GNU General Public License for more details.
+  \;; You should have received a copy of the GNU General Public License
+  \;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  \;;; Commentary:
+  \;; " _ "
+  \;;; Code:
+  \(provide '"
+         (file-name-base)
+         ")
+  \;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")))
+#+END_SRC
+
 ** Completion
 
 company mode
@@ -2191,3 +2239,6 @@ See [[https://www.emacswiki.org/emacs/GnusWindowLayout][GnusWindowLayout]]
 - passion
 - vision
 - mission
+* TODO Convert ASCII to key
+map =function-key-map= [[http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm][ascii_ctrl]]
+new file =C-x C-f C-f=