(defun dot () (point)) (defun find-profanity-re () "Run this in the context of a buffer, typically a shell buffer, that contains the output stream from the findprof2 alias, q.v. Given this context, this function grabs each line (as a file name), visits that file in another window, and search down for the profanity regular expression." (interactive) ; Grab the current line as a file name. (beginning-of-line) (setq d (dot)) (end-of-line) (setq file (buffer-substring d (dot))) ; Move to the beginning of the next line so that when we come back here we're ; ready to grab the next file. (next-line 1) (beginning-of-line) ; Visit the file in another window. (find-file-other-window file) ; Go to the beginnning of the buffer, in case the file happens already to be ; open. (beginning-of-buffer) ; Save the current value of case-fold search, set it to true, do the ; profanity search, then resent case-fold to its original value. (let ((case-fold-search-save case-fold-search)) (setq case-fold-search t) (search-forward-regexp "fuck\\|shit\\|piss\\|cunt") (setq case-fold-search case-fold-search-save) ) ; Go back to the file-list window (disabled for now). ; (other-window 1) ) (defun fp () "A convenience search function to use in the context of find-profanity-re, q.v." (interactive) (search-forward-regexp "fuck\\|shit\\|piss\\|cunt") )