Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (progn
- ;; inserts hello name
- (defun hello (name)
- (insert (format "Hello %s!\n" name)))
- ;; calls hello with list of names in another window
- (defun greeting (names)
- (progn
- (switch-to-buffer-other-window "*test*")
- (erase-buffer)
- (mapcar 'hello names)
- (other-window 1)
- )
- )
- ;; replace hellos with a word
- (defun replace-hello (with)
- (progn
- (switch-to-buffer-other-window "*test*")
- (goto-char (point-min))
- (while (search-forward "Hello" nil t)
- (replace-match with))
- (other-window 1)))
- ;; search for word and add bold text properties
- (defun boldify-names (name)
- (progn
- (switch-to-buffer-other-window "*test*")
- (goto-char (point-min))
- (while (re-search-forward (format "%s \\(.+\\)!" name) nil t)
- (add-text-properties (match-beginning 1)
- (match-end 1)
- (list 'face 'bold)))
- (other-window 1)
- )
- )
- ;; run the functions
- (setq list-of-names '("chloe" "clare" "bob" "hope") list-of-last-names '("jones" "town" "city" "street"))
- (let ((replaced-name "Gutten Tag"))
- (push "steph" list-of-names)
- (greeting list-of-names)
- (replace-hello replaced-name)
- (boldify-names replaced-name)))
Add Comment
Please, Sign In to add comment