Skip to content

Latest commit

 

History

History
899 lines (840 loc) · 34.3 KB

gc.org

File metadata and controls

899 lines (840 loc) · 34.3 KB

What’s this?

This is my config garbage collection. Just in case someday I find those useful.

LSP hack

(setq-default lsp-ui-doc-frame-parameters
            '((left . -1)
                (top . -1)
                (no-accept-focus . t)
                (min-width . 0)
                (width . 0)
                (min-height . 0)
                (height . 0)
                (internal-border-width . 5)
                (vertical-scroll-bars)
                (horizontal-scroll-bars)
                (left-fringe . 0)
                (right-fringe . 0)
                (menu-bar-lines . 0)
                (tool-bar-lines . 0)
                (line-spacing . 0.1)
                (unsplittable . t)
                (undecorated . t)
                (minibuffer . nil)
                (visibility . nil)
                (mouse-wheel-frame . nil)
                (no-other-frame . t)
                (cursor-type)
                (no-special-glyphs . t)))
(defun lsp-ui-doc--make-frame ()
"Create the child frame and return it."
(lsp-ui-doc--delete-frame)
(let* ((after-make-frame-functions nil)
        (before-make-frame-hook nil)
        (name-buffer (lsp-ui-doc--make-buffer-name))
        (buffer (get-buffer name-buffer))
        (params (append lsp-ui-doc-frame-parameters
                        `(
                            ;; (default-minibuffer-frame . ,(selected-frame))
                            ;; (minibuffer . ,(minibuffer-window))
                            (background-color . ,(doom-blend 'blue 'bg 0.1)))))
        (window (display-buffer-in-child-frame
                buffer
                `((child-frame-parameters . ,params))))
        (frame (window-frame window)))
    (set-frame-parameter nil 'lsp-ui-doc-buffer buffer)
    (set-window-dedicated-p window t)
    ;; (redirect-frame-focus frame (frame-parent frame))
    (set-face-background 'internal-border lsp-ui-doc-border frame)
    (run-hook-with-args 'lsp-ui-doc-frame-hook frame window)
    frame))
(defun my-fontify-mode (text mode)
(with-temp-buffer
    (erase-buffer)
    (insert text)
    (delay-mode-hooks (funcall mode))
    (font-lock-default-function mode)
    (goto-char (point-min))
    (font-lock-default-fontify-region (point-at-bol) (point-at-eol) nil)
    (forward-line 1)
    (while (not (eq (line-number-at-pos) (line-number-at-pos (point-max))))
    (if (re-search-forward "[][@#$%^&*|+=\\<>{}]" (point-at-eol) t)
        (font-lock-default-fontify-region (point-at-bol) (point-at-eol) nil))
    (forward-line 1))
    (buffer-string)))
(defun my-fontify-using-faces (text)
(let ((pos 0))
    (while (setq next (next-single-property-change pos 'face text))
    (put-text-property pos next 'font-lock-face (get-text-property pos 'face text) text)
    (setq pos next))
    (add-text-properties 0  (length text) '(fontified t) text)
    text))
(defun lsp-ui-doc--render-buffer (string symbol)
"set the buffer with string.
symbol."
(let ((pmode major-mode))
    (lsp-ui-doc--with-buffer
    (erase-buffer)
    (insert (my-fontify-using-faces (my-fontify-mode string pmode)))
    (lsp-ui-doc--make-clickable-link)
    (hl-line-mode -1)
    (setq-local face-remapping-alist `((header-line lsp-ui-doc-header)))
    (setq-local window-min-height 1)
    ;; (variable-pitch-mode 1)
    (setq header-line-format (when lsp-ui-doc-header (concat " " symbol))
            mode-line-format nil
            cursor-type nil))))

Magithub filter

(require 'parse-time)
(defmacro magithub--time-number-of-days-since-string (iso8601)
`(time-to-number-of-days
    (time-since
    (parse-iso8601-time-string
    (concat ,iso8601 "+00:00")))))
(defun issue-filter-to-days (days type)
`(lambda (issue)
    (let ((created_at (magithub--time-number-of-days-since-string
                        (alist-get 'created_at issue)))
            (updated_at (magithub--time-number-of-days-since-string
                        (alist-get 'updated_at issue))))
        (or (< created_at ,days) (< updated_at ,days)))))
(defun magithub-filter-maybe (&optional limit)
"Add filters to magithub only if number of issues is greter than LIMIT."
(let ((max-issues (length (ignore-errors (magithub-issues))))
        (max-pull-requests (length (ignore-errors (magithub-pull-requests))))
        (limit (or limit 1)))
    (when (> max-issues limit)
    (add-to-list (make-local-variable 'magithub-issue-issue-filter-functions)
                    (issue-filter-to-days limit "issues")))
    (when (> max-pull-requests limit)
    (add-to-list (make-local-variable 'magithub-issue-pull-request-filter-functions)
                    (issue-filter-to-days limit "pull-requests")))))
(add-to-list 'magit-status-mode-hook #'magithub-filter-maybe)

Evil-escape

  • Make it can escape from minibuffer
(def-package-hook! evil-escape
:pre-config
(defun evil-escape-p ()
"Return non-nil if evil-escape can run."
(and evil-escape-key-sequence
        (not evil-escape-inhibit)
        (or (window-minibuffer-p)
            (bound-and-true-p isearch-mode)
            (memq major-mode '(ibuffer-mode
                            image-mode))
            (evil-escape--is-magit-buffer)
            (+popup-windows)
            (and (fboundp 'helm-alive-p) (helm-alive-p))
            (or (not (eq 'normal evil-state))
                (not (eq 'evil-force-normal-state
                        (lookup-key evil-normal-state-map [escape])))))
        (not (memq major-mode evil-escape-excluded-major-modes))
        (not (memq evil-state evil-escape-excluded-states))
        (or (not evil-escape-enable-only-for-major-modes)
            (memq major-mode evil-escape-enable-only-for-major-modes))
        (or (equal (this-command-keys) (evil-escape--first-key))
            (and evil-escape-unordered-key-sequence
                (equal (this-command-keys) (evil-escape--second-key))))
        (not (cl-reduce (lambda (x y) (or x y))
                        (mapcar 'funcall evil-escape-inhibit-functions)
                        :initial-value nil))))
(defun evil-escape--escape-normal-state ()
"Return the function to escape from normal state."
(cond
    ((and (fboundp 'helm-alive-p) (helm-alive-p)) 'helm-keyboard-quit)
    ((eq 'ibuffer-mode major-mode) 'ibuffer-quit)
    ((eq 'image-mode major-mode) 'quit-window)
    ((evil-escape--is-magit-buffer) 'evil-escape--escape-with-q)
    ((bound-and-true-p isearch-mode) 'isearch-abort)
    ((window-minibuffer-p) (kbd "C-g"))
    (t (lookup-key evil-normal-state-map [escape]))))
(setq-default evil-escape-delay 0.1
            evil-escape-excluded-states nil)
(map! :irvo "C-g" #'evil-escape)
nil)

ssh-deploy

  • used to emit errors
(def-package-hook! ssh-deploy
:pre-init
(def-package! ediff-diff
:commands (ediff-same-file-contents))
t)

fringe and contiuation symbol

  • used to be this
(or standard-display-table
(setq standard-display-table (make-display-table)))
(set-display-table-slot standard-display-table 0 ?\ )
(setq fringe-indicator-alist (delq
                            (assq 'truncation fringe-indicator-alist)
                            (delq (assq 'continuation fringe-indicator-alist)
                                fringe-indicator-alist)))
  • Now use this:
(map-delete fringe-indicator-alist 'truncation)

Org babel hack

(defun +org-private|org-edit-src-code (&optional code edit-buffer-name)
"Edit the source or example block at point.
\\<org-src-mode-map>
The code is copied to a separate buffer and the appropriate mode
is turned on.  When done, exit with `\\[org-edit-src-exit]'.  This \
will remove the
original code in the Org buffer, and replace it with the edited
version.  See `org-src-window-setup' to configure the display of
windows containing the Org buffer and the code buffer.

When optional argument CODE is a string, edit it in a dedicated
buffer instead.

When optional argument EDIT-BUFFER-NAME is non-nil, use it as the
name of the sub-editing buffer."
(interactive)
(let* ((element (org-element-at-point))
        (type (org-element-type element)))
(unless (and (memq type '(example-block src-block))
                (org-src--on-datum-p element))
    (user-error "Not in a source or example block"))
(let* ((lang
        (if (eq type 'src-block) (org-element-property :language element)
            "example"))
        (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang)))
        (babel-info (and (eq type 'src-block)
                        (org-babel-get-src-block-info 'light)))
        deactivate-mark)
    (when (and (eq type 'src-block) (not (functionp lang-f)))
    (error "No such language mode: %s" lang-f))
    (org-src--edit-element
    element
    (or edit-buffer-name
        (org-src--construct-edit-buffer-name (buffer-name) lang))
    lang-f
    (and (null code)
        (lambda () (org-escape-code-in-region (point-min) (point-max))))
    (and code (org-unescape-code-in-string code)))
    ;; Finalize buffer.
    (setq-local org-coderef-label-format
                (or (org-element-property :label-fmt element)
                    org-coderef-label-format))
    (when (eq type 'src-block)
    (let* ((org-src--babel-info babel-info)
            (params (nth 2 babel-info))
            (dir (cdr (assq :dir params))))
        (if (bound-and-true-p dir)
            (cd (file-name-as-directory (expand-file-name dir)))))
    (let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang))))
        (when (fboundp edit-prep-func)
        (funcall edit-prep-func babel-info))))
    t)))
(advice-add #'org-edit-src-code :override #'+org-private|org-edit-src-code)

org-wild-notifier

Pretty buggy beast…
(def-package! org-wild-notifier
:commands (org-wild-notifier-mode
            org-wild-notifier-check)
:config
(setq org-wild-notifier-keyword-whitelist '("TODO" "HABT")))
(defun start-org-wild-notifier ()
(if (bound-and-true-p org-wild-notifier-mode)
    (message "You already have notifier with you!")
(run-with-timer 60 nil 'org-wild-notifier-mode 1)
(message "Org wild notifier, naughty naughty fire!")))
(start-org-wild-notifier)

Set transparency

(defun +xfu/set--transparency (inc)
"Increase or decrease the selected frame transparency"
(let* ((alpha (frame-parameter (selected-frame) 'alpha))
        (next-alpha (cond ((not alpha) 100)
                        ((> (- alpha inc) 100) 100)
                        ((< (- alpha inc) 0) 0)
                        (t (- alpha inc)))))
(set-frame-parameter (selected-frame) 'alpha next-alpha)))

(defhydra +xfu/set-transparency (:columns 2)
"
ALPHA : [ %(frame-parameter nil 'alpha) ]
"
("j" (lambda () (interactive) (+xfu/set--transparency 1)) "+ more")
("k" (lambda () (interactive) (+xfu/set--transparency -1)) "- less")
("J" (lambda () (interactive) (+xfu/set--transparency 10)) "++ more")
("K" (lambda () (interactive) (+xfu/set--transparency -10)) "-- less")
("=" (lambda (value) (interactive "nTransparency Value 0 - 100 opaque:")
        (set-frame-parameter (selected-frame) 'alpha value)) "Set to ?" :color blue))

Well I didn’t actually used that…

Magit Popup

I used to use those popup rule, but now I simply use @hlissner ‘s config.

(setq magit-bury-buffer-function #'+magit/quit
    magit-popup-display-buffer-action nil
    magit-display-file-buffer-function 'switch-to-buffer-other-window)

(map! :map magit-mode-map
    [remap quit-window] #'+magit/quit
    :n "\\" nil)
(set! :popup "^\\(?: ?\\*\\)?magit.*: "
'((slot . -1) (side . right) (size . 80))
'((select . t) (quit . nil)))

(set! :popup "^\\*magithub-dash\\*"
'((slot . -3) (side . right) (window-height . 20))
'((select . t)))
(def-modeline-segment! magithub-buffer-info-simple
"striped magithub buffer name"
(substring (buffer-name) 11 -1))
(def-modeline-segment! magit-title
"striped magithub buffer name"
(let* ((str "M A G I T")
        (num (max 0 (/ (- (window-width
                        (selected-window)) (string-width str)) 2))))
(concat +doom-modeline--bar-inactive (propertize (concat (make-string num ? ) str) 'face 'bold))))

(def-modeline-segment! magithub-title
"striped magithub buffer name"
(let* ((str "D A S H B O A R D")
        (num (max 0 (/ (- (window-width
                        (selected-window)) (string-width str)) 2))))
(concat +doom-modeline--bar-inactive (propertize (concat (make-string num ? ) str) 'face 'bold))))

(def-modeline! magit-title
(magit-title))

(def-modeline! magithub-title
(magithub-title))

(def-modeline! magithub
(bar matches " " magithub-buffer-info-simple))
(set! :popup "^\\*magithub: .*\\*"
'((slot . -2) (side . right) (window-height . 0.6))
'((select . t)))

(defun +magithub|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magithub) mode-line-format)
    mode-line-format nil))
(add-hook 'magithub-issue-view-mode-hook #'+magithub|switch-mode-and-header-line)

(defun +magit|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magit-title) mode-line-format)
    mode-line-format nil))
(add-hook 'magit-status-mode-hook #'+magit|switch-mode-and-header-line)

(defun +magithub-dash|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magithub-title) mode-line-format)
    mode-line-format nil))
(add-hook 'magithub-dash-mode-hook #'+magithub-dash|switch-mode-and-header-line)

(set! :popup "^\\*magit.*popup\\*"
'((slot . 0) (side . right))
'((select . t)))
(set! :popup "^\\(?: ?\\*\\)?magit-revision:.*"
'((slot . 2) (side . right) (window-height . 0.6))
'((select . t)))
(set! :popup "^\\(?: ?\\*\\)?magit-diff:.*"
'((slot . 2) (side . right) (window-height . 0.6))
'((select . nil)))

Pretty magit

(def-package! pretty-magit
:load-path "~/.doom.d/local/"
:commands (pretty-magit))
(pretty-magit "Feature" ? '(:foreground "slate gray" :height 1.0 :family "FontAwesome"))
(pretty-magit "Add" ? '(:foreground "#375E97" :height 1.0 :family "FontAwesome"))
(pretty-magit "Fix" ? '(:foreground "#FB6542" :height 1.0 :family "FontAwesome"))
(pretty-magit "Clean" ? '(:foreground "#FFBB00" :height 1.0 :family "FontAwesome"))
(pretty-magit "Docs" ? '(:foreground "#3F681C" :height 1.0 :family "FontAwesome"))
(pretty-magit "master" ? '(:box nil :height 1.0 :family "github-octicons") t)
(pretty-magit "origin" ? '(:box nil :height 1.0 :family "github-octicons") t)

Pinentry

(def-package! pinentry
:commands (pinentry-start))
(run-with-idle-timer
10
nil
(lambda!
(require 'pass)
(pinentry-start)))

git commit when org-log

(defvar *org-git-notes nil
  "use log notes for git commit notes")
(defun *org-store-log-note ()
  "Finish taking a log note, and insert it to where it belongs."
  (let ((txt (prog1 (buffer-string)
               (kill-buffer)))
        (note (cdr (assq org-log-note-purpose org-log-note-headings)))
        lines)
    (while (string-match "\\`# .*\n[ \t\n]*" txt)
      (setq txt (replace-match "" t t txt)))
    (when (string-match "\\s-+\\'" txt)
      (setq txt (replace-match "" t t txt)))
    (setq lines (and (not (equal "" txt)) (org-split-string txt "\n")))
    (when (org-string-nw-p note)
      (setq note
            (org-replace-escapes
             note
             (list (cons "%u" (user-login-name))
                   (cons "%U" user-full-name)
                   (cons "%t" (format-time-string
                               (org-time-stamp-format 'long 'inactive)
                               org-log-note-effective-time))
                   (cons "%T" (format-time-string
                               (org-time-stamp-format 'long nil)
                               org-log-note-effective-time))
                   (cons "%d" (format-time-string
                               (org-time-stamp-format nil 'inactive)
                               org-log-note-effective-time))
                   (cons "%D" (format-time-string
                               (org-time-stamp-format nil nil)
                               org-log-note-effective-time))
                   (cons "%s" (cond
                               ((not org-log-note-state) "")
                               ((string-match-p org-ts-regexp
                                                org-log-note-state)
                                (format "\"[%s]\""
                                        (substring org-log-note-state 1 -1)))
                               (t (format "\"%s\"" org-log-note-state))))
                   (cons "%S"
                         (cond
                          ((not org-log-note-previous-state) "")
                          ((string-match-p org-ts-regexp
                                           org-log-note-previous-state)
                           (format "\"[%s]\""
                                   (substring
                                    org-log-note-previous-state 1 -1)))
                          (t (format "\"%s\""
                                     org-log-note-previous-state)))))))
      (when lines (setq note (concat note " \\\\")))
      (push note lines))
    (when (and lines (not org-note-abort))
      (setq *org-git-notes (concat *org-git-notes ": " (substring-no-properties (car lines))))
      (with-current-buffer (marker-buffer org-log-note-marker)
        (org-with-wide-buffer
         ;; Find location for the new note.
         (goto-char org-log-note-marker)
         (set-marker org-log-note-marker nil)
         ;; Note associated to a clock is to be located right after
         ;; the clock.  Do not move point.
         (unless (eq org-log-note-purpose 'clock-out)
           (goto-char (org-log-beginning t)))
         ;; Make sure point is at the beginning of an empty line.
         (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert "\n")))
               ((looking-at "[ \t]*\\S-") (save-excursion (insert "\n"))))
         ;; In an existing list, add a new item at the top level.
         ;; Otherwise, indent line like a regular one.
         (let ((itemp (org-in-item-p)))
           (if itemp
               (indent-line-to
                (let ((struct (save-excursion
                                (goto-char itemp) (org-list-struct))))
                  (org-list-get-ind (org-list-get-top-point struct) struct)))
             (org-indent-line)))
         (insert (org-list-bullet-string "-") (pop lines))
         (let ((ind (org-list-item-body-column (line-beginning-position))))
           (dolist (line lines)
             (insert "\n")
             (indent-line-to ind)
             (insert line)))
         (message "Note stored")
         (org-back-to-heading t)
         (org-cycle-hide-drawers 'children))
        ;; Fix `buffer-undo-list' when `org-store-log-note' is called
        ;; from within `org-add-log-note' because `buffer-undo-list'
        ;; is then modified outside of `org-with-remote-undo'.
        (when (eq this-command 'org-agenda-todo)
          (setcdr buffer-undo-list (cddr buffer-undo-list)))
        (let ((file (buffer-file-name)))
          (require 'magit)
          (magit-call-git "add" file)
          (magit-call-git "commit" "-m" (concat file ": " *org-git-notes))
          (magit-refresh)))))
  ;; Don't add undo information when called from `org-agenda-todo'.
  (let ((buffer-undo-list (eq this-command 'org-agenda-todo)))
    (set-window-configuration org-log-note-window-configuration)
    (with-current-buffer (marker-buffer org-log-note-return-to)
      (goto-char org-log-note-return-to))
    (move-marker org-log-note-return-to nil)
    (when org-log-post-message (message "%s" org-log-post-message))))
(advice-add 'org-store-log-note :override #'*org-store-log-note)

Prevoius lispy config

(def-package! lispy
  :hook ((emacs-lisp-mode . lispy-mode))
  :init
  (setq-default
   lispy-outline "^;; \\(?:;[^#]\\|\\*+\\)"
                lispy-outline-header ";; "
                )
  :config
  (add-hook 'emacs-lisp-mode-hook #'lispy-mode t)
  (add-hook 'lispy-mode-hook #'turn-off-smartparens-mode)
  (map! :map lispy-mode-map
        :i "_" #'special-lispy-different
        :i "C-d" #'lispy-delete
        :i "C-u" #'universal-argument
        :i [remap delete-backward-char] #'lispy-delete-backward))
(def-package! lispyville
  :after (evil)
  :hook (lispy-mode . lispyville-mode)
  :config
  (lispyville-set-key-theme
   '(operators
     c-w
     prettify
     escape
     (slurp/barf-lispy))))

electric-operators

(def-package! electric-operator
  :hook ((sh-mode . electric-operator-mode)
         (ess-mode . electric-operator-mode)
         (python-mode . electric-operator-mode)))

smartparens

(after! smartparens
  (add-hook 'minibuffer-setup-hook #'smartparens-mode)
  (add-hook 'eshell-mode-hook #'smartparens-mode)
  ;; Auto-close more conservatively and expand braces on RET
  (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
  (let ((unless-list '(sp-point-before-word-p
                       sp-point-after-word-p
                       sp-point-before-same-p)))
    (sp-pair "'" nil :unless unless-list)
    (sp-pair "\"" nil :unless unless-list))
  (sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
           :unless '(sp-point-before-word-p sp-point-before-same-p))
  (sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
           :unless '(sp-point-before-word-p sp-point-before-same-p))
  (sp-pair "[" nil :post-handlers '(("| " " "))
           :unless '(sp-point-before-word-p sp-point-before-same-p)))

auths for conda and tramp

org-latex settings

(defun +org-private|init-latex ()
  (setq-default org-latex-prefer-user-labels t)
  (cond
   ((eq window-system 'mac)
    (setq-default org-format-latex-options
                  `(:background ,(doom-color 'bg)
                                :foreground ,(doom-color 'fg)
                                :scale 1
                                :html-foreground ,(doom-color 'fg)
                                :html-background "Transparent"
                                :html-scale 1.0
                                :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
                  org-highlight-latex-and-related '(latex)
                  org-latex-packages-alist
                  '(("" "color" t)
                    ("" "minted" t)
                    ("" "parskip" t)
                    ("" "koma-script" t)
                    ("" "tikz" t))
                  org-latex-pdf-process '("latexmk -pdflatex='lualatex -shell-escape -interaction nonstopmode' -pdf -f  %f")
                  org-preview-latex-default-process 'dvisvgm
                  org-preview-latex-image-directory (concat doom-cache-dir "org-latex/")))
   ((eq window-system 'ns)
    (add-to-list 'org-latex-classes
             '("scrreprt"
               "\\documentclass{scrreprt}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
    (setq-default org-format-latex-options
                  `(:background ,(doom-color 'bg)
                                :foreground ,(doom-color 'fg)
                                :scale 2.0
                                :html-foreground ,(doom-color 'fg)
                                :html-background "Transparent"
                                :html-scale 1.0
                                :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
                  org-highlight-latex-and-related '(latex)
                  org-latex-listings 'minted
                  org-latex-packages-alist
                  '(("" "color" t)
                    ("" "minted" t)
                    ("" "booktabs" t)
                    ("" "tabularx" t)
                    ("" "parskip" t)
                    ("" "tikz" t))
                  org-latex-pdf-process '("latexmk -pdflatex='lualatex -shell-escape -interaction nonstopmode' -pdf -f  %f")
                  org-preview-latex-default-process 'imagemagick
                  org-preview-latex-image-directory (concat doom-cache-dir "org-latex/")))))

Old magit setting

;; (def-package! orgit :after (magit org))
;; (after! magithub
;;   (setq magithub-clone-default-directory "~/Repo/"))
;; (after! magit
;;   (defun +magit|remove-fringes ()
;;     (set-window-fringes nil 0 0)
;;     (set-window-margins nil 1 nil))
;;   (add-hook 'magit-post-display-buffer-hook #'+magit|remove-fringes t)
;;   (add-hook! magit-popup-mode-hook #'+magit|remove-fringes)

;;   (after! solaire-mode
;;     (add-hook 'magit-mode-hook #'solaire-mode))
;;   (magit-wip-after-save-mode 1)
;;   (magit-wip-after-apply-mode 1)
;;   (setq magit-save-repository-buffers 'dontask)
;;   (advice-add 'magit-list-repositories :override #'*magit-list-repositories))

Old org-pdftools code on isearch highlight

(when page
  (let* ((matches (pdf-info-search-regexp
                   search-string
                   page))
         (edges (apply
                 'append
                 (map
                  'list
                  (lambda (a)
                    (alist-get 'edges a))
                  matches)))
         (width (car (pdf-view-image-size)))
         (window (selected-window))
         (buffer (current-buffer))
         (pdf-info-asynchronous
          (lambda (status data)
            (when (and (null status)
                       (buffer-live-p buffer)
                       (window-live-p window)
                       (eq (window-buffer window)
                           buffer))
              (with-selected-window window
                (when (and (derived-mode-p 'pdf-view-mode)
                           (eq page (pdf-view-current-page)))
                  (pdf-view-display-image
                   (pdf-view-create-image data))))))))
    (cl-destructuring-bind
        (fg1 bg1 fg2 bg2)
        (pdf-isearch-current-colors)
      (pdf-info-renderpage-text-regions
       page
       (car (pdf-view-image-size))
       t
       (current-buffer)
       (append `(,fg1 ,bg1) edges)))))

Old org keybinding

;; (defun +org-private|setup-keybinds ()
;;   (map! (:map evil-org-mode-map
;;           ;; :i <S-tab> #'+org/dedent
;;           "M-o" #'org-open-at-point
;;           "M-i" #'org-insert-last-stored-link
;;           "M-I" #'org-insert-link
;;           "M-p" #'org-ref-ivy-insert-cite-link
;;           :nvime "C-j" (lambda! (org-next-visible-heading 1) (recenter))
;;           :nvime "C-k" (lambda! (org-previous-visible-heading 1) (recenter))
;;           :nv "M-j" nil
;;           :nv "M-k" nil
;;           :nv "M-l" nil
;;           :nv "M-h" nil

;;           :ni "<M-backspace>" #'org-babel-remove-result
;;           :ni "<M-return>" #'+org/work-on-heading
;;           :n "RET" #'+org/dwim-at-point
;;           :i "RET" #'org-return-indent
;;           :n [tab] #'org-cycle
;;           :n "M-t" nil
;;           :m "]v" #'org-next-block
;;           :m "[v" #'org-previous-block
;;           :m "]i" #'org-next-item
;;           :m "[i" #'org-previous-item
;;           :m "]h" #'org-next-visible-heading
;;           :m "[h" #'org-previous-visible-heading
;;           :m "_" #'evil-org-beginning-of-line
;;           :m "0" (λ! (let ((visual-line-mode)) (org-beginning-of-line)))
;;           :n "gQ" #'org-fill-paragraph
;;           :ni [M-return] #'org-meta-return
;;           :ni [S-M-return] (lambda! (+org/insert-go-eol)
;;                                     (call-interactively #'org-insert-todo-heading))
;;           (:localleader
;;             :n "," #'org-ctrl-c-ctrl-c
;;             :n "s" #'org-schedule
;;             :n "m" #'+org-toggle-math
;;             :n "b" #'+org-private@org-babel-hydra/body
;;             :n "c" #'org-columns
;;             :n "C" (lambda () (interactive) (let ((current-prefix-arg 2)) (call-interactively #'org-columns)))
;;             :n "L" #'+org/remove-link
;;             :n "d" #'org-deadline
;;             :n "'" #'org-edit-special
;;             :n "e" #'org-set-effort
;;             :n "t" #'org-todo
;;             :n "r" #'org-refile
;;             :n [tab] #'org-export-dispatch
;;             :n "E" #'org-clock-modify-effort-estimate
;;             :n "p" #'org-set-property
;;             :n "i" #'org-clock-in
;;             :n "o" #'org-clock-out
;;             :n "=" (λ! (call-interactively #'evil-append) (insert (+reference/skim-get-annotation)))
;;             :n "n" #'org-narrow-to-subtree
;;             :n "N" #'org-narrow-to-element
;;             :n "w" #'widen
;;             :n "$" #'wordnut-lookup-current-word
;;             :n "h" #'org-toggle-heading
;;             :n "A" #'org-archive-subtree
;;             :n "a" #'org-toggle-archive-tag))
;;         (:after org-agenda
;;           (:map org-agenda-mode-map
;;             ;; :nm <escape> #'org-agenda-Quit
;;             :nm "j" #'evil-next-line
;;             :nm "k" #'evil-previous-line
;;             :nm "J" #'org-clock-convenience-timestamp-down
;;             :nm "K" #'org-clock-convenience-timestamp-up
;;             :nm "M-j" #'org-agenda-later
;;             :nm "M-k" #'org-agenda-earlier
;;             :nm "M-o" #'org-clock-convenience-fill-gap
;;             :nm "M-e" #'org-clock-convenience-fill-gap-both
;;             ;; :nm "\\" #'ace-window
;;             :nm "t" #'org-agenda-todo
;;             :nm "p" #'org-set-property
;;             :nm "r" #'org-agenda-redo
;;             :nm "e" #'org-agenda-set-effort
;;             :nm "L" #'org-agenda-log-mode
;;             :nm "D" #'org-agenda-toggle-diary
;;             :nm "G" #'org-agenda-toggle-time-grid
;;             :nm ";" #'counsel-org-tag-agenda
;;             :nm "M-j" #'counsel-org-goto-all
;;             :nm "i" #'org-agenda-clock-in
;;             :nm "o" #'org-agenda-clock-out
;;             :nm [tab] #'org-agenda-goto
;;             :nm "C" #'org-agenda-capture
;;             :nm "m" #'org-agenda-bulk-mark
;;             :nm "u" #'org-agenda-bulk-unmark
;;             :nm "U" #'org-agenda-bulk-unmark-all
;;             :nm "f" #'+org@org-agenda-filter/body
;;             :nm "-" #'org-agenda-manipulate-query-subtract
;;             :nm "=" #'org-agenda-manipulate-query-add
;;             :nm "_" #'org-agenda-manipulate-query-subtract-re
;;             :nm "$" #'org-agenda-manipulate-query-add-re
;;             :nm "d" #'org-agenda-deadline
;;             :nm "q" #'org-agenda-quit
;;             :nm "s" #'org-agenda-schedule
;;             :nm "z" #'org-agenda-view-mode-dispatch
;;             :nm "S" #'org-save-all-org-buffers)
;;           (:map org-super-agenda-header-map
;;             "j" #'evil-next-line
;;             "k" #'evil-previous-line))))

python, sed, pkgbuild

(after! python
  (add-hook 'python-mode-hook #'outline-minor-mode)
  (set-company-backend! 'python-mode '(company-anaconda :with company-yasnippet company-dabbrev company-files))
  (set-lookup-handlers! 'python-mode :documentation #'anaconda-mode-show-doc))
(use-package! sed-mode
  :commands (sed-mode))
(when IS-LINUX
  (use-package! pkgbuild-mode
    :mode (("/PKGBUILD$" . pkgbuild-mode))))

company-mode

(setq company-tooltip-limit 10
      company-tooltip-minimum-width 80
      company-tooltip-minimum 10
      company-backends
      '(company-capf company-dabbrev company-files company-yasnippet)
      company-global-modes '(not comint-mode erc-mode message-mode help-mode gud-mode))

flycheck-posframe

(after! flycheck-posframe
  (setq flycheck-posframe-warning-prefix ""
        flycheck-posframe-info-prefix "··· "
        flycheck-posframe-error-prefix "")
  ;; (advice-add 'flycheck-posframe-delete-posframe :override #'*flycheck-posframe-delete-posframe)
  (advice-add 'flycheck-posframe-show-posframe :override #'*flycheck-posframe-show-posframe)
  ;; (advice-add '+syntax-checker-cleanup-popup :override #'+syntax-checker*cleanup-popup)
  )

web, xwidget, shr

(after! eww
  (advice-add 'eww-display-html :around
              'eww-display-html--override-shr-external-rendering-functions))
(after! shr
  (require 'shr-tag-pre-highlight)
  (add-to-list 'shr-external-rendering-functions
               '(pre . shr-tag-pre-highlight)))
(after! xwidget
  (advice-add 'xwidget-webkit-new-session :override #'*xwidget-webkit-new-session)
  (advice-add 'xwidget-webkit-goto-url :override #'*xwidget-webkit-goto-url)
  (setq xwidget-webkit-enable-plugins t))

iterm

(use-package! iterm :load-path
 :commands (iterm-cd+END_SRC
             iterm-send-text
             iterm-send-text-i
             iterm-send-file-i
             iterm-cwd-ipy
             iterm-send-file-R
             iterm-cwd-R
             iterm-send-file-j
             iterm-cwd-julia))

ivy

;; **** ivy-config
(after! ivy
  (ivy-add-actions
   'ivy-switch-buffer
   '(("d" (lambda (buf) (display-buffer buf)) "display")))
  (setq ivy-use-selectable-prompt t
        ivy-rich-parse-remote-buffer nil
        +ivy-buffer-icons nil
        ivy-use-virtual-buffers nil
        ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-cd-selected
        ivy-rich-switch-buffer-name-max-length 50))
(after! ivy-posframe
  (setq ivy-posframe-height-alist '((counsel-M-x . 20)
                                    (counsel-recentf . 20)
                                    (counsel-find-file . 20)
                                    (counsel-projectile-find-file . 20)
                                    (projectile-find-file . 20)
                                    (ivy-switch-buffer . 20))))
(after! ivy-rich
  (setq ivy-rich-display-transformers-list
        (plist-put ivy-rich-display-transformers-list
                   'counsel-M-x
                   '(:columns
                     ((counsel-M-x-transformer (:width 30)) ; the original transformer
                      (ivy-rich-counsel-function-docstring (:width 70 :face font-lock-doc-face))))))
  (ivy-rich-mode +1))