[emacs] include non-ASCII counterparts in search results
[~bandali/configs] / init.org
index 9457e5f..f8c87b5 100644 (file)
--- a/init.org
+++ b/init.org
@@ -645,14 +645,23 @@ Enable =winner-mode=.
          (cons msg code)))
 #+end_src
 
+*** Search for non-ASCII characters
+
+I’d like non-ASCII characters such as ‘’“”«»‹›áⓐ𝒶 to be selected when
+I search for their ASCII counterpart.  Shoutout to [[http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html][endlessparentheses]]
+for this.
+
+#+begin_src emacs-lisp
+(setq search-default-mode #'char-fold-to-regexp)
+
+;; uncomment to extend this behaviour to query-replace
+;; (setq replace-char-fold t)
+#+end_src
+
 ** Bindings
 
 #+begin_src emacs-lisp
 (bind-keys
- ("C-c F m" . make-frame-command)
- ("C-c F d" . delete-frame)
- ("C-c F D" . delete-other-frames)
-
  ("s-c e b" . eval-buffer)
  ("s-c e r" . eval-region)
 
@@ -727,7 +736,22 @@ customizing it.
 
   ;; fix tab and indentation in src blocks inside org-mode buffer
   ;; also see https://git.sr.ht/~bandali/dotfiles/commit/0e2ffd584aafdd4cf256bcdf2473f01c3aaaed55
-  (unbind-key "TAB" evil-motion-state-map))
+  (unbind-key "TAB" evil-motion-state-map)
+
+  (unbind-key "C-d" evil-insert-state-map)
+  (unbind-key "C-v" evil-insert-state-map)
+  (unbind-key "C-y" evil-insert-state-map)
+  (unbind-key "C-a" evil-insert-state-map)
+  (unbind-key "C-e" evil-insert-state-map)
+  (unbind-key "C-p" evil-insert-state-map)
+  (unbind-key "C-n" evil-insert-state-map)
+  (unbind-key "C-k" evil-insert-state-map)
+  (bind-keys
+    :map evil-insert-state-map
+    ("C-k"   . kill-line)
+    ("C-S-k" . evil-insert-digraph)
+    :map evil-motion-state-map
+    ([down-mouse-1] . nil)))
 #+end_src
 
 #+begin_src emacs-lisp
@@ -747,6 +771,27 @@ customizing it.
   (push #'minibufferp evil-escape-inhibit-functions))
 #+end_src
 
+#+begin_src emacs-lisp
+(use-package evil-nerd-commenter
+  :after evil
+  :general
+  (nmap
+    "gc" 'evilnc-comment-operator
+    "gy" 'evilnc-copy-and-comment-lines))
+#+end_src
+
+#+begin_src emacs-lisp
+(use-package evil-surround
+  :after evil
+  :general
+  (omap
+    "s" 'evil-surround-edit
+    "S" 'evil-Surround-edit)
+  (vmap
+    "S" 'evil-surround-region
+    "gS" 'evil-Surround-region))
+#+end_src
+
 #+begin_src emacs-lisp
 (amin--leader-keys
   "/"   '(:ignore t :wk "search")
@@ -755,8 +800,19 @@ customizing it.
   "b k" 'kill-this-buffer
   "b s" 'save-buffer
 
+  "e"   '(:ignore t :wk "eval")
+  "e b" 'eval-buffer
+  "e r" 'eval-region
+
+  "e e" 'shell-pop
+
   "f"   '(:ignore t :wk "files")
 
+  "F"   '(:ignore t :wk "frames")
+  "F m" 'make-frame-command
+  "F d" 'delete-frame
+  "F D" 'delete-other-frames
+
   "h"   '(:ignore t :wk "help(ful)")
   "h c" 'describe-char
   "h f" 'describe-function
@@ -771,6 +827,12 @@ customizing it.
 
   "w"   '(:ignore t :wk "window")
   "w o" 'other-window
+  "w 0" 'delete-window
+  "w 1" 'delete-other-windows
+  "w 2" 'split-window-below
+  "w 3" 'split-window-right
+  "w u" 'winner-undo
+  "w r" 'winner-redo
 
   "q"   '(:ignore t :wk "quit")
   "q q" 'save-buffers-kill-terminal)
@@ -928,6 +990,10 @@ Not just how I do git, but /the/ way to do git.
                           'magit-insert-modules
                           'magit-insert-stashes
                           'append)
+  (setq
+   magit-repository-directories '(("~/.emacs.d/" . 0)
+                                  ("~/src/git/" . 1)))
+  (push (cons [unpushed status] 'show) magit-section-initial-visibility-alist)
   :custom-face (magit-diff-file-heading ((t (:weight normal)))))
 #+end_src
 
@@ -1655,8 +1721,10 @@ Emacs package that displays available keybindings in popup
     "f c" 'crux-copy-file-preserve-attributes
     "f d" 'crux-delete-file-and-buffer
     "f r" 'crux-rename-file-and-buffer)
-  :bind (("C-S-j"   . crux-top-join-line)
-         ("C-c j"   . crux-top-join-line)))
+  :bind (("C-c d" . crux-duplicate-current-line-or-region)
+         ("C-c D" . crux-duplicate-and-comment-current-line-or-region)
+         ("C-S-j" . crux-top-join-line)
+         ("C-c j" . crux-top-join-line)))
 #+end_src
 
 ** [[https://github.com/alezost/mwim.el][mwim]]
@@ -1857,6 +1925,9 @@ Hopefully temporary.
    :subscribed-channels '(general)
    :full-and-display-names t)
   (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t)
+  (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]"
+        lui-time-stamp-only-when-changed-p t
+        lui-time-stamp-position 'right)
   :bind
   (("C-c s s" . slack-start)
    ("C-c s u" . slack-select-unread-rooms)
@@ -1936,6 +2007,13 @@ For when I /have to/ use GH.
   (setq magithub-clone-default-directory "~/src/git"))
 #+end_src
 
+** [[https://github.com/peterwvj/eshell-up][eshell-up]]
+
+#+begin_src emacs-lisp
+(use-package eshell-up
+  :after eshell)
+#+end_src
+
 * Email
 
 #+begin_src emacs-lisp
@@ -2040,6 +2118,8 @@ For when I /have to/ use GH.
            (body "\nBest,\namin\n"))
           ("gnu.*"
            (address "bandali@gnu.org"))
+          ((header "subject" "ThankCRM")
+           (to "webmasters-comment@gnu.org"))
           ("nnimap\\+uwaterloo:.*"
            (address "abandali@uwaterloo.ca")
            (gcc "\"nnimap+uwaterloo:Sent Items\"")))))
@@ -2077,7 +2157,17 @@ For when I /have to/ use GH.
 #+begin_src emacs-lisp
 (use-package message
   :config
-  (setq message-kill-buffer-on-exit t
+  (defconst message-cite-style-bandali
+    '((message-cite-function  'message-cite-original)
+      (message-citation-line-function  'message-insert-formatted-citation-line)
+      (message-cite-reply-position 'traditional)
+      (message-yank-prefix  "> ")
+      (message-yank-cited-prefix  ">")
+      (message-yank-empty-prefix  ">")
+      (message-citation-line-format "Hi %F,\n\nOn %Y-%m-%d %l:%M %p, %N wrote:"))
+    "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
+  (setq message-cite-style 'message-cite-style-bandali
+        message-kill-buffer-on-exit t
         message-send-mail-function 'message-send-mail-with-sendmail
         message-sendmail-envelope-from 'header
         message-dont-reply-to-names
@@ -2121,7 +2211,7 @@ Convenient footnotes in =message-mode=.
         footnote-style     'unicode))
 #+end_src
 
-** supercite
+** COMMENT supercite
 
 #+begin_src emacs-lisp
 (use-package supercite
@@ -2131,20 +2221,32 @@ Convenient footnotes in =message-mode=.
         ;; sc-cite-blank-lines-p t
         sc-citation-leader ""
         sc-reference-tag-string ""
+        sc-preferred-header-style 5     ; (sc-header-author-writes)
         sc-auto-fill-region-p nil
         sc-confirm-always-p nil)
   :config
-  (defun amin--sc-header ()
-    "Hi <firstname>,\n\n <from> writes:"
-    (let ((sc-mumble "")
-             (whofrom (sc-whofrom)))
-      (if whofrom
-             (insert (sc-hdr "Hi " (sc-mail-field "sc-firstname") ",\n\n")
-                  sc-reference-tag-string
-                         whofrom
-                         " writes:\n"))))
-  (add-to-list 'sc-rewrite-header-list '(amin--sc-header) t)
-  (setq sc-preferred-header-style (1- (length sc-rewrite-header-list)))
+  ;;   (defun amin--sc-header-on-wrote ()
+  ;;     "\"On <date>, <sc-author> wrote:\" unless:
+  ;; 1. the \"sc-author\" field cannot be found, in which case nothing is inserted;
+  ;; 2. the \"date\" field is missing in which case only the from part is printed."
+  ;;     (let ((sc-mumble "")
+  ;;         (whofrom (sc-whofrom)))
+  ;;       (if whofrom
+  ;;         (insert sc-reference-tag-string
+  ;;                     (sc-hdr "On " (sc-mail-field "date") ", ")
+  ;;                     (sc-hdr "" (sc-mail-field "sc-author")) " wrote:\n"))))
+  ;;   (defun amin--sc-header ()
+  ;;     "Hi <firstname>,\n\n <from> writes:"
+  ;;     (let ((sc-mumble "")
+  ;;         (whofrom (sc-whofrom)))
+  ;;       (if whofrom
+  ;;         (insert (sc-hdr "Hi " (sc-mail-field "sc-firstname") ",\n\n")
+  ;;                   sc-reference-tag-string
+  ;;                     whofrom
+  ;;                     " writes:\n"))))
+  ;; (add-to-list 'sc-rewrite-header-list '(amin--sc-header) t)
+  ;; (add-to-list 'sc-rewrite-header-list '(amin--sc-header-on-wrote) t)
+  ;; (setq sc-preferred-header-style (1- (length sc-rewrite-header-list)))
   (add-hook 'mail-citation-hook 'sc-cite-original))
 #+end_src