Lint wpc-misc.el

- prefer user-emacs-directory
- prefer wpc-misc- prefix
This commit is contained in:
William Carroll 2020-08-31 14:10:08 +01:00
parent d813128e90
commit d3d94cbbac

View file

@ -37,7 +37,7 @@
(setq initial-scratch-message "") (setq initial-scratch-message "")
;; disable custom variable entries from being written to ~/.emacs.d/init.el ;; disable custom variable entries from being written to ~/.emacs.d/init.el
(setq custom-file "~/.emacs.d/custom.el") (setq custom-file (f-join user-emacs-directory "custom.el"))
(load custom-file 'noerror) (load custom-file 'noerror)
;; integrate Emacs with X11 clipboard ;; integrate Emacs with X11 clipboard
@ -206,15 +206,15 @@
:config :config
(projectile-mode t)) (projectile-mode t))
(defun project-find-function--briefcase (dir) ;; TODO: Consider moving this into a briefcase.el module.
"Find the nearest default.nix file; otherwise, terminate at the .git (defun wpc-misc--briefcase-find (dir)
directory." "Find the default.nix nearest to DIR."
(when (s-starts-with? constants/briefcase (f-expand dir)) (when (s-starts-with? constants/briefcase (f-expand dir))
(if (f-exists? (f-join dir "default.nix")) (if (f-exists? (f-join dir "default.nix"))
(cons 'transient dir) (cons 'transient dir)
(project-find-function--briefcase (f-parent dir))))) (wpc-misc--briefcase-find (f-parent dir)))))
(add-to-list 'project-find-functions #'project-find-function--briefcase) (add-to-list 'project-find-functions #'wpc-misc--briefcase-find)
(use-package deadgrep (use-package deadgrep
:config :config
@ -223,17 +223,17 @@
:states 'normal :states 'normal
"o" #'deadgrep-visit-result-other-window) "o" #'deadgrep-visit-result-other-window)
(setq-default deadgrep--context '(0 . 3)) (setq-default deadgrep--context '(0 . 3))
(defun deadgrep/region () (defun wpc-misc-deadgrep-region ()
"Run a ripgrep search on the active region." "Run a ripgrep search on the active region."
(interactive) (interactive)
(deadgrep (region/to-string))) (deadgrep (region/to-string)))
(defun deadgrep/dwim () (defun wpc-misc-deadgrep-dwim ()
"If a region is active, use that as the search, otherwise don't." "If a region is active, use that as the search, otherwise don't."
(interactive) (interactive)
(with-current-buffer (current-buffer) (with-current-buffer (current-buffer)
(if (region-active-p) (if (region-active-p)
(setq deadgrep--additional-flags '("--multiline")) (setq deadgrep--additional-flags '("--multiline"))
(deadgrep/region) (wpc-misc-deadgrep-region)
(call-interactively #'deadgrep)))) (call-interactively #'deadgrep))))
(advice-add (advice-add
'deadgrep--format-command 'deadgrep--format-command
@ -292,10 +292,6 @@
:config :config
(define-key prog-mode-map (kbd "M-RET") #'emr-show-refactor-menu)) (define-key prog-mode-map (kbd "M-RET") #'emr-show-refactor-menu))
(defun wpc/frame-name ()
"Return the name of the current frame."
(frame-parameter nil 'name))
;; Start the Emacs server ;; Start the Emacs server
(server-start) (server-start)