summary refs log tree commit diff stats
path: root/lisp/acdw.el
diff options
context:
space:
mode:
authorCase Duckworth2021-10-07 18:24:23 -0500
committerCase Duckworth2021-10-07 18:24:23 -0500
commitbb5d048df691abbb0dde2b3174d4dcd91b466099 (patch)
tree7e0f77dfe48f177985d8e4c2d3ed0791708c60d6 /lisp/acdw.el
parentFix spacing (diff)
parentBreak spongebob-case to its own package (diff)
downloademacs-bb5d048df691abbb0dde2b3174d4dcd91b466099.tar.gz
emacs-bb5d048df691abbb0dde2b3174d4dcd91b466099.zip
Merge branch 'main' of github.com:duckwork/.emacs.d
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r--lisp/acdw.el44
1 files changed, 17 insertions, 27 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 5d23e72..df2962a 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -787,32 +787,6 @@ This function is internal. Use `acdw/make-password-fetcher' instead."
787 (insert "💩") 787 (insert "💩")
788 (setq n (1- n))))) 788 (setq n (1- n)))))
789 789
790(defun spongebob-case-region (beg end)
791 "Make region, defined by BEG and END, lOoK lIkE tHiS."
792 (interactive "*r")
793 (save-excursion
794 (let (case)
795 (goto-char beg)
796 (while (< (point) end)
797 (if (looking-at "[[:alpha:]]")
798 (if (setq case (not case))
799 (upcase-region (point) (progn (forward-char 1) (point)))
800 (downcase-region (point) (progn (forward-char 1) (point))))
801 (forward-char 1))))))
802
803(defun spongebob-case-word (n)
804 "Spongebob-case N words forward, beginning at point, moving over."
805 (interactive "*p")
806 (spongebob-case-region (point) (progn (forward-word n) (point))))
807
808(defun spongebob-case-dwim (arg)
809 "Spongebob-case words in the region if active, else word at point.
810If ARG exists, it's passed to `spongebob-case-word'."
811 (interactive "*p")
812 (if (use-region-p)
813 (spongebob-case-region (region-beginning) (region-end))
814 (spongebob-case-word arg)))
815
816 790
817;;; Fat finger solutions 791;;; Fat finger solutions
818(defun acdw/fat-finger-exit (&optional prefix) 792(defun acdw/fat-finger-exit (&optional prefix)
@@ -872,7 +846,23 @@ three blank lines, then place the point on the second one."
872 (newline) 846 (newline)
873 (delete-blank-lines) 847 (delete-blank-lines)
874 (newline 2) 848 (newline 2)
875 (previous-line)) 849 (forward-line -1))
850
851(defun require/ (feature &optional filename noerror)
852 "If FEATURE is not loaded, load it from FILENAME.
853This function works just like `require', with one crucial
854difference: if the FEATURE name contains a slash, the FILENAME
855will as well -- unless, of course, FILENAME is set. This allows
856for `require/' to require files within subdirectories of
857directories of `load-path'. Of course, NOERROR isn't affected by
858the change."
859 (let* ((feature-name (if (symbolp feature)
860 (symbol-name feature)
861 feature))
862 (filename (or filename
863 (and (string-match-p "/" feature-name)
864 feature-name))))
865 (require (intern feature-name) filename noerror)))
876 866
877(provide 'acdw) 867(provide 'acdw)
878;;; acdw.el ends here 868;;; acdw.el ends here