From f658d8659045cef76d69b394fc51a5cba6d6bd43 Mon Sep 17 00:00:00 2001 From: Macoy Madson Date: Wed, 17 Oct 2018 18:19:03 -0700 Subject: [PATCH] Codesearch file filter, isearch from clipboard, dsvn faces * Codesearch now filters its results through grep -v so files can be easily ignored via regex * C-v will paste clipboard into isearch. This doesn't work perfectly because isearch treats that as one addition, so backspace completely deletes the string :( * DSVN now has faces which match the theme :) --- Emacs/emacsConfig.txt | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Emacs/emacsConfig.txt b/Emacs/emacsConfig.txt index 509b549..bc6748d 100644 --- a/Emacs/emacsConfig.txt +++ b/Emacs/emacsConfig.txt @@ -56,7 +56,6 @@ ;; - Multiple cursors copy and cut when whole line selected ;; - Ido jump to file anywhere does more harm than good (especially when creating new files) ;; - Python indentation is troublesome in originally poorly formatted files -;; - Make C-g quit selection and multiple cursors if mc is active ;; - Auto-install packages just by loading .emacs ;; (use-package? https://github.com/jwiegley/use-package but I don't want to get locked in) ;; - Shortcuts: @@ -70,7 +69,6 @@ ;; - tags-query-replace use marked for tag to replace ;; - Recover from commit failed backup command (or at least quick-open recovery file) ;; - Fix windows OpenSSL/TLS support -;; - Fix multiple-cursors slow parenthesis completion (due to pause to show matching?) ;; - Build system management (use (funcall (intern "my-func-name")) to ido select build system?) ;; - Jump copy thing at point then paste back at start ;; e.g. the macro would avy prompt, jump to destination, copy it, then go back and paste it at start mark @@ -95,9 +93,12 @@ ;; - Find file in dir (basically ido find file but actually useful; how does it work?) ;; - Macoy-Codesearch should have something for whole word searches as well as sanitizing regex symbols ;;*- IMPORTANT Codesearch ignore autogenerated files (maybe during building index?) +;; - Codesearch doesn't seem to actually be updating during index (wtf?) ;; - Isearch: Make reversing the isearch not find the same thing again ;; - Isearch: Always put cursor at end of search (try searching backwards; it'll put it at the front) -;; +;; - Isearch: If you paste a thing into isearch, then go up or down a bit, then hit backspace, it returns +;; to the last search until you get to the original place, then it clears the search. This is confusing :( +;;;; ;; Criticism improvements: ;; - [DONE] Select word at point ;; - [DONE] Reopen closed file @@ -483,20 +484,29 @@ "Codesearch results compilation mode" ) -(defun macoy-codesearch-search (pattern) +;; The filter which will apply to codesearch results. Things matching this regex will be removed +;; This is useful for e.g. filtering autogenerated code files +;; Note that this will also remove code lines which match this pattern, so make the regex robust to that +(setq macoy-codesearch-ignore-lines-pattern "_ast\.") + +(defun macoy-codesearch-search-with-filter (pattern) (interactive (list (read-string "Search: " (thing-at-point 'symbol)))) ;; Use the compile command so we have nice clickable links ;; Note that without regexp-quote, this does support regexes. I don't want them in my case ;; Args explanation: -n (Line numbers) -i (ignore case) - (compilation-start (format "%s -n -i %s" codesearch-csearch-exe (regexp-quote pattern)) + ;; Output Codesearch results to a temporary file, filter out lines, then clean up the temp file + (compilation-start (format "%s -n -i %s > .temp-codesearch.txt && grep -v %s .temp-codesearch.txt && rm .temp-codesearch.txt" + codesearch-csearch-exe + (regexp-quote pattern) + macoy-codesearch-ignore-lines-pattern) #'macoy-codesearch-mode `(lambda (mode-name) , "*Codesearch*") ) ) -(global-set-key (kbd "C-S-f") 'macoy-codesearch-search) +(global-set-key (kbd "C-S-f") 'macoy-codesearch-search-with-filter) ;; Simpleclip makes system clipboard and emacs kill ring separate ;; This is sane copy paste behavior @@ -716,10 +726,17 @@ (tags-search (ido-completing-read "Tag: " macoy-tag-names)) )) +;; Find references (global-set-key (kbd "C-\\") 'macoy-tags-search) (global-set-key (kbd "C-|") 'tags-loop-continue) ;; Isearch customizations +(defun macoy-isearch-yank-clipboard () + "Insert the contents of the clipboard into isearch. We do this because we don't use the yank stuff" + (interactive) + (isearch-yank-string (simpleclip-get-contents)) + ) +(define-key isearch-mode-map (kbd "C-v") 'macoy-isearch-yank-clipboard) ;; Go to next/previous result with arrow keys (define-key isearch-mode-map (kbd "") 'isearch-repeat-backward) (define-key isearch-mode-map (kbd "") 'isearch-repeat-forward) @@ -1388,6 +1405,9 @@ static char *gnus-pointer[] = { (set-face-background 'avy-lead-face-1 (face-foreground 'match)) (set-face-foreground 'avy-lead-face-2 (face-background 'match)) (set-face-background 'avy-lead-face-2 (face-foreground 'match)) +;; Make dsvn marked face match theme +(set-face-foreground 'svn-mark-face (face-foreground 'region)) +(set-face-background 'svn-mark-face (face-background 'region)) ;; Hide these modes completely (for a more minimal look) ;; Diminish things down here so that we're sure we catch all modes