Paste number 76437: horizontal-rule

Paste number 76437: horizontal-rule
Pasted by: dowaito
When:11 months, 1 week ago
Share:Tweet this! | http://paste.lisp.org/+1MZ9
Channel:None
Paste contents:
Raw Source | XML | Display As
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
;; I create a lot simple lines to delineate sections when taking notes in 
;; meetings and  what not.
;; Rather than type "C-u 80 -" every time, I created the following.

(defun horizontal-rule (&optional char)
  (interactive)
  "Create a line of 'char' (defaaults to '-') the width of the current window"
  (progn 
	 (beginning-of-line)
	 (insert-char 
	  (if (stringp char) 
			(string-to-char (substring char 0 1)) (string-to-char "-"))
	  (window-width))
	 (newline)))

(global-set-key (kbd "C-c -") 'horizontal-rule)

;; Now I can build upon horizontal-rule to do other kinds of lines in my notes.
;; Below I have bound "C-c ~" to give me a line of tilde characters for when 
;; I'm feeling fancy.

(defun horizontal-rule-tilde () (interactive) 
  "Create a line of '~' characters the width of the current window"
  (horizontal-rule "~"))

(global-set-key (kbd "C-c ~") 'horizontal-rule-tilde) 

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.