Browse Source

C-S-Backspace kill subword, codesearch upgrade

I changed to a different codesearch branch,
https://github.com/junkblocker/codesearch, to avoid filtering via grep
master
macoymadson@gmail.com 3 years ago
parent
commit
ab97c34236
  1. 9
      Emacs/keybinds.el
  2. 58
      Emacs/search.el
  3. 2
      Emacs/visual-late.el

9
Emacs/keybinds.el

@ -114,7 +114,16 @@
(subword-mode 0)
)
(defun macoy-kill-subword-backward ()
"Temporarily enable subword mode to kill camelCase subword"
(interactive)
(subword-mode 1)
(call-interactively 'backward-kill-word)
(subword-mode 0)
)
(global-set-key (kbd "C-S-<delete>") 'macoy-kill-subword)
(global-set-key (kbd "C-S-<backspace>") 'macoy-kill-subword-backward)
;; Simpleclip cut copy paste (not sure if this is essential due to customize-group settings)
;; These are also set in my-keys mode with macoyCopy functions for multiple-cursors support,

58
Emacs/search.el

@ -139,9 +139,19 @@ If there's a string at point, offer that as a default."
;; (global-set-key (kbd "C-M-F") 'ag)
;; Codesearch: Use a pregenerated index to search files. Requires Codesearch
;; Whether or not files have already been filtered
;; Get this fork for required feature https://github.com/junkblocker/codesearch
;; If you want to use Google's version, set codesearch-filter-supported to nil
;; and set macoy-codesearch-ignore-lines-pattern
(setq codesearch-filter-supported t)
;;
;; Always rescan all folders when indexing
(setq codesearch-cindex-args "-reset")
(if codesearch-filter-supported
(setq codesearch-cindex-args (list "-reset" "-exclude" "f:/CJUNCTIONS/src/csearchIgnorePatterns"))
;; Use if junkblocker codesearch fork is not used
(setq codesearch-cindex-args (list "-reset")))
;; User-specific settings for codesearch
(when (string-equal (user-login-name) "mmadson")
@ -167,8 +177,10 @@ If there's a string at point, offer that as a default."
(message "Running Codesearch index on %s" directory)
(set (make-local-variable 'compilation-environment)
(list (format "%s%s%s" "CSEARCHINDEX=" directory "/.csearchindex")))
(compile (format "%s %s %s" codesearch-cindex-exe codesearch-cindex-args directory))
)
(compile (string-join
(append (list codesearch-cindex-exe)
codesearch-cindex-args
(list directory)) " ")))
(defun macoy-codesearch-index-default ()
(interactive)
@ -181,7 +193,10 @@ If there's a string at point, offer that as a default."
;; )
;; We won't use this way for now so that we can run two indexes at the same time
;; (macoy-codesearch-index-directory codesearch-dir-to-index)
(let ((codesearch-proc (start-process "CodesearchIndex" "*Codesearch-Index*" codesearch-cindex-exe codesearch-cindex-args codesearch-dir-to-index)))
(let ((codesearch-proc (apply 'start-process
(append (list "CodesearchIndex" "*Codesearch-Index*" codesearch-cindex-exe)
codesearch-cindex-args
(list codesearch-dir-to-index)))))
(set-process-sentinel codesearch-proc
(lambda (codesearch-proc _string)
(message "Codesearch finished building index")))
@ -214,6 +229,7 @@ If there's a string at point, offer that as a default."
;; 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
;; Only used if codesearch-filter-supported = nil
(setq macoy-codesearch-ignore-lines-pattern "_ast\.|_autogen")
(defun macoy-codesearch-search-with-filter-directory (pattern directory)
@ -226,19 +242,27 @@ If there's a string at point, offer that as a default."
(set (make-local-variable 'compilation-environment) (list (format "%s%s%s" "CSEARCHINDEX=" directory "/.csearchindex")))
(set (make-local-variable 'compilation-environment) nil)
)
;; This temp-file thing sucks but seems necessary for Windows
(compilation-start (format "%s -n -i \"%s\" > %s && grep -i -E -v \"%s\" %s && rm %s"
codesearch-csearch-exe
;; (regexp-quote pattern) ;; This doesn't work because more escape(\) chars are added
pattern
codesearch-temp-file
macoy-codesearch-ignore-lines-pattern
codesearch-temp-file
codesearch-temp-file)
#'macoy-codesearch-mode
`(lambda (mode-name) , "*Codesearch*")
)
)
(if codesearch-filter-supported
(compilation-start (format "%s -n -i \"%s\""
codesearch-csearch-exe
;; (regexp-quote pattern) ;; This doesn't work because more escape(\) chars are added
pattern
codesearch-temp-file)
#'macoy-codesearch-mode
`(lambda (mode-name) , "*Codesearch*")
)
;; This temp-file thing sucks but seems necessary for Windows
(compilation-start (format "%s -n -i \"%s\" > %s && grep -i -E -v \"%s\" %s && rm %s"
codesearch-csearch-exe
;; (regexp-quote pattern) ;; This doesn't work because more escape(\) chars are added
pattern
codesearch-temp-file
macoy-codesearch-ignore-lines-pattern
codesearch-temp-file
codesearch-temp-file)
#'macoy-codesearch-mode
`(lambda (mode-name) , "*Codesearch*")
)))
(defun macoy-codesearch-search-src (pattern)
(interactive (list (macoy-read-from-minibuffer "Search string")))

2
Emacs/visual-late.el

@ -43,7 +43,7 @@
(global-set-key (kbd "<f9>") 'macoy-cycle-transparency)
;; Add a slight border to give us some breathing room on the edges
(set-frame-parameter (selected-frame) 'internal-border-width 5)
(set-frame-parameter (selected-frame) 'internal-border-width 10)
;; Uncomment to disable the edge border
;; (set-frame-parameter (selected-frame) 'internal-border-width 0)

Loading…
Cancel
Save