[emacs] remove unnecessary overrides & silence some compile warnings
[~bandali/configs] / init.org
index f05e53c..7f66c99 100644 (file)
--- a/init.org
+++ b/init.org
@@ -652,27 +652,25 @@ Based on https://stackoverflow.com/a/17788551, with changes to use
 =cl-letf= instead of the now obsolete =flet=.
 
 #+begin_src emacs-lisp
-(defun amin--compilation-finish-function (buffer outstr)
-  (unless (string-match "finished" outstr)
-    (switch-to-buffer-other-window buffer))
-  t)
-
-(setq compilation-finish-functions #'amin--compilation-finish-function)
+(use-package compile
+  :config
+  (defun amin--compilation-finish-function (buffer outstr)
+    (unless (string-match "finished" outstr)
+      (switch-to-buffer-other-window buffer))
+    t)
 
-(require 'cl-macs)
+  (setq compilation-finish-functions #'amin--compilation-finish-function)
 
-(setq ad-redefinition-action 'accept)
-(defadvice compilation-start
-    (around inhibit-display
-            (command &optional mode name-function highlight-regexp))
-  (if (not (string-match "^\\(find\\|grep\\)" command))
-      (cl-letf (((symbol-function 'display-buffer)   #'ignore)
-                ((symbol-function 'set-window-point) #'ignore)
-                ((symbol-function 'goto-char)        #'ignore))
-        (save-window-excursion ad-do-it))
-    ad-do-it))
+  (require 'cl-macs)
 
-(ad-activate 'compilation-start)
+  (defadvice compilation-start
+      (around inhibit-display
+              (command &optional mode name-function highlight-regexp))
+    (if (not (string-match "^\\(find\\|grep\\)" command))
+        (cl-letf (((symbol-function 'display-buffer) #'ignore))
+          (save-window-excursion ad-do-it))
+      ad-do-it))
+  (ad-activate 'compilation-start))
 #+end_src
 
 *** Search for non-ASCII characters
@@ -825,7 +823,8 @@ file.
     (let* ((file-tangle-start-time (current-time))
            (file (buffer-file-name))
            (file-nodir (file-name-nondirectory file))
-           (async-quiet-switch "-q"))
+           ;; (async-quiet-switch "-q")
+           )
       (async-start
        `(lambda ()
           (require 'org)
@@ -955,7 +954,7 @@ There's no way I could top that, so I won't attempt to.
 
   (defun amin|eshell-setup ()
     (make-local-variable 'company-idle-delay)
-    (setq company-idle-delay nil)
+    (defvar company-idle-delay nil)
     (bind-keys :map eshell-mode-map
                ("C-d"   . amin/eshell-quit-or-delete-char)
                ("C-S-l" . amin/eshell-clear)
@@ -2280,7 +2279,6 @@ Display how long it took to load the init file.
 (message "Loading %s...done (%.3fs)" user-init-file
          (float-time (time-subtract (current-time)
                                     amin--before-user-init-time)))
-(setq ad-redefinition-action 'warn)
 #+end_src
 
 * Footer