mirror of
https://github.com/larstvei/dot-emacs.git
synced 2024-11-26 07:28:31 +00:00
27 lines
659 B
EmacsLisp
27 lines
659 B
EmacsLisp
|
;-------------[ This function creates headers like this one ]-------------;
|
||
|
|
||
|
(defun header ()
|
||
|
(interactive)
|
||
|
(beginning-of-line)
|
||
|
(if (and (eolp) (bolp))
|
||
|
(insert ";;")
|
||
|
(progn
|
||
|
(insert ";[ ")
|
||
|
(move-end-of-line 1)
|
||
|
(insert " ];")))
|
||
|
(add-dashes))
|
||
|
|
||
|
(defun add-dashes ()
|
||
|
;; lets wait, just for fun.
|
||
|
(sit-for 0.006)
|
||
|
(end-of-line)
|
||
|
(let ((line-length (current-column)))
|
||
|
(if (oddp line-length)
|
||
|
(progn
|
||
|
(beginning-of-line)
|
||
|
(forward-char))
|
||
|
(backward-char))
|
||
|
(insert "-")
|
||
|
(unless (< 73 line-length)
|
||
|
(add-dashes))))
|