From 897eee81de8b3f6adf0165f50e95600a7b89c20c Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 4 Feb 2015 21:41:42 +0100 Subject: Standalone lisp and snippet repo --- .../text-mode/emacs-lisp-mode/word-or-region | 27 ---------------------- 1 file changed, 27 deletions(-) delete mode 100644 .emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region (limited to '.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region') diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region deleted file mode 100644 index 66a59e4..0000000 --- a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/word-or-region +++ /dev/null @@ -1,27 +0,0 @@ -#name : Command that works on region or word -#contributor : Xah Lee -# -- -;; example of a command that works on current word or text selection -(defun down-case-word-or-region () - "Lower case the current word or text selection." -(interactive) -(let (pos1 pos2 meat) - (if (and transient-mark-mode mark-active) - (setq pos1 (region-beginning) - pos2 (region-end)) - (setq pos1 (car (bounds-of-thing-at-point 'symbol)) - pos2 (cdr (bounds-of-thing-at-point 'symbol)))) - - ; now, pos1 and pos2 are the starting and ending positions - ; of the current word, or current text selection if exists - - ;; put your code here. - $0 - ;; Some example of things you might want to do - (downcase-region pos1 pos2) ; example of a func that takes region as args - (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text. - (delete-region pos1 pos2) ; get rid of it - (insert "newText") ; insert your new text - - ) -) -- cgit v1.3