Klimi's new dotfiles with stow.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

27 wiersze
961 B

4 lat temu
  1. # -*- mode: snippet -*-
  2. # name: Command that works on region or word
  3. # contributor : Xah Lee
  4. # --
  5. ;; example of a command that works on current word or text selection
  6. (defun down-case-word-or-region ()
  7. "Lower case the current word or text selection."
  8. (interactive)
  9. (let (pos1 pos2 meat)
  10. (if (and transient-mark-mode mark-active)
  11. (setq pos1 (region-beginning)
  12. pos2 (region-end))
  13. (setq pos1 (car (bounds-of-thing-at-point 'symbol))
  14. pos2 (cdr (bounds-of-thing-at-point 'symbol))))
  15. ; now, pos1 and pos2 are the starting and ending positions
  16. ; of the current word, or current text selection if exists
  17. ;; put your code here.
  18. $0
  19. ;; Some example of things you might want to do
  20. (downcase-region pos1 pos2) ; example of a func that takes region as args
  21. (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text.
  22. (delete-region pos1 pos2) ; get rid of it
  23. (insert "newText") ; insert your new text
  24. )
  25. )