A bunch of changes
This commit is contained in:
93
init.el
93
init.el
@ -215,7 +215,8 @@ BUFFER can be a string or a buffer."
|
||||
((stringp buffer)
|
||||
(not (string-prefix-p " " buffer)))
|
||||
((bufferp buffer)
|
||||
(my/buffer-visible-p (buffer-name buffer)))
|
||||
(and (stringp (buffer-name buffer))
|
||||
(my/buffer-visible-p (buffer-name buffer))))
|
||||
(t
|
||||
(signal 'wrong-type-argument `((or bufferp stringp) ,buffer)))))
|
||||
|
||||
@ -378,7 +379,8 @@ directory. Otherwise, run `find-file' on that file."
|
||||
:hook (undo-tree-visualizer-mode . my/-undo-tree-visualizer-mode-setup)
|
||||
:config
|
||||
(defun my/-undo-tree-visualizer-mode-setup ()
|
||||
(visual-line-mode -1))
|
||||
(visual-line-mode -1)
|
||||
(setq truncate-lines t))
|
||||
(global-undo-tree-mode))
|
||||
|
||||
;; evil
|
||||
@ -722,11 +724,21 @@ to `posframe-show' if the display is graphical."
|
||||
:init
|
||||
(defun my/flymake-show-diagnostic-at-point ()
|
||||
(interactive)
|
||||
(if-let ((pos (point))
|
||||
(diag (and flymake-mode
|
||||
(get-char-property pos 'flymake-diagnostic)))
|
||||
(message (flymake--diag-text diag)))
|
||||
(my/floating-tooltip " *flymake-error-posframe*" message))))
|
||||
(when flymake-mode
|
||||
(let* ((diag (get-char-property (point) 'flymake-diagnostic))
|
||||
(diag-msg (when diag
|
||||
(apply 'concat
|
||||
(mapcar
|
||||
(lambda (msg)
|
||||
(concat "•" msg "\n"))
|
||||
(split-string (flymake--diag-text diag)
|
||||
"\n")))))
|
||||
(jinx-msg (when (jinx--get-overlays (point) (1+ (point)))
|
||||
"•misspelled word\n")))
|
||||
(unless (and (zerop (length diag-msg))
|
||||
(zerop (length jinx-msg)))
|
||||
(my/floating-tooltip " *flymake-error-posframe*"
|
||||
(concat diag-msg jinx-msg)))))))
|
||||
|
||||
;; flycheck
|
||||
(use-package flycheck
|
||||
@ -740,12 +752,15 @@ to `posframe-show' if the display is graphical."
|
||||
(defun my/flycheck-show-diagnostic-at-point ()
|
||||
(interactive)
|
||||
(if-let ((flycheck-mode)
|
||||
(errors (flycheck-overlay-errors-at (point)))
|
||||
(message (apply 'concat
|
||||
(mapcar
|
||||
(lambda (error)
|
||||
(concat "•" (flycheck-error-message error) "\n"))
|
||||
errors))))
|
||||
(message
|
||||
(apply 'concat
|
||||
(nconc (mapcar
|
||||
(lambda (error)
|
||||
(concat "•" (flycheck-error-message error) "\n"))
|
||||
(flycheck-overlay-errors-at (point)))
|
||||
(when (jinx--get-overlays (point) (1+ (point)))
|
||||
'("•misspelled word\n")))))
|
||||
((not (zerop (length message)))))
|
||||
(my/floating-tooltip " *flycheck-error-posframe*"
|
||||
(substring message 0 (1- (length message)))))))
|
||||
(use-package consult-flycheck
|
||||
@ -1019,7 +1034,7 @@ When EXCLUDE-BRACES is non-nil, don't count the first and last brace of the
|
||||
entry as in the entry. That is, if the point is on the first { or last } of the
|
||||
entry, return nil."
|
||||
(save-excursion
|
||||
(when (and exclude-braces (= ?\} (char-after)))
|
||||
(when (and exclude-braces (eq ?\} (char-after)))
|
||||
(forward-char))
|
||||
;; go to top level and check if the character at point is {
|
||||
(let ((start-pos (point))
|
||||
@ -1030,7 +1045,7 @@ entry, return nil."
|
||||
(setq last-valid (point)))
|
||||
(error
|
||||
(and
|
||||
(= ?\{ (char-after last-valid))
|
||||
(eq ?\{ (char-after last-valid))
|
||||
(or (not exclude-braces)
|
||||
(not (= start-pos last-valid)))))))))
|
||||
(defvar my/bibtex-indent-width 4
|
||||
@ -1082,10 +1097,14 @@ otherwise, call `bibtex-find-text'."
|
||||
(evil-define-key 'normal bibtex-mode-map
|
||||
(kbd "TAB") 'my/bibtex-indent-or-find-text-and-insert)
|
||||
|
||||
;; Latex help (from elisp file)
|
||||
(require 'latex-help)
|
||||
|
||||
;; AUCTeX
|
||||
(use-package auctex
|
||||
:hook ((LaTeX-mode . turn-on-reftex)
|
||||
(LaTeX-mode . LaTeX-math-mode))
|
||||
(LaTeX-mode . LaTeX-math-mode)
|
||||
(LaTeX-mode . my/-setup-LaTeX-mode))
|
||||
:init
|
||||
(add-to-list 'major-mode-remap-alist '(plain-tex-mode . plain-TeX-mode))
|
||||
(add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode))
|
||||
@ -1095,6 +1114,8 @@ otherwise, call `bibtex-find-text'."
|
||||
(add-to-list 'major-mode-remap-alist '(doctex-mode . docTeX-mode))
|
||||
(add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode))
|
||||
:config
|
||||
(defun my/-setup-LaTeX-mode ()
|
||||
(setq evil-lookup-func 'latex-help-at-point))
|
||||
(setq TeX-auto-save t
|
||||
TeX-parse-self t
|
||||
reftex-plug-into-AUCTeX t)
|
||||
@ -1419,7 +1440,7 @@ argument."
|
||||
(funcall-interactively #'sage-shell:run-sage
|
||||
(sage-shell:read-command)))))
|
||||
|
||||
;; fricas (because I like calculator)
|
||||
;; fricas (because I like calculators)
|
||||
(add-to-list 'load-path "/usr/lib/fricas/emacs/")
|
||||
(use-package fricas
|
||||
:ensure nil
|
||||
@ -1762,10 +1783,14 @@ If no name is given, list all bookmarks instead."
|
||||
(setq-local evil-lookup-func #'helpful-at-point))
|
||||
(defun my/-setup-helpful-mode ()
|
||||
(setq-local evil-lookup-func #'helpful-at-point))
|
||||
(defvar my/helpful-symbol-history-size 20
|
||||
(defvar my/helpful-symbol-history-size 50
|
||||
"Max size of `my/helpful-symbol-history'.")
|
||||
(defvar my/helpful-symbol-history '()
|
||||
"History of helpful symbols.")
|
||||
(defvar my/-helpful-inhibit-history nil
|
||||
"If non-nil, don't add symbols to `my/helpful-symbol-history'.")
|
||||
(defvar my/-helpful-last-entry nil
|
||||
"Last entry looked up with helpful.")
|
||||
(defun my/helpful-history-back (count)
|
||||
"Go back COUNT symbols in `my/helpful-symbol-history'. If called
|
||||
interactively, COUNT defaults to 1."
|
||||
@ -1791,7 +1816,8 @@ the oldest entry if -COUNT is larger than the history."
|
||||
((and (< count 0) (= (1+ current-pos) hist-len))
|
||||
(message "%s" "No older symbol!"))
|
||||
(t
|
||||
(let ((entry (cond
|
||||
(let ((my/-helpful-inhibit-history t)
|
||||
(entry (cond
|
||||
((<= new-pos 0)
|
||||
(seq-first my/helpful-symbol-history))
|
||||
((>= new-pos hist-len)
|
||||
@ -1804,29 +1830,29 @@ the oldest entry if -COUNT is larger than the history."
|
||||
(defun my/-helpful-switch-buffer-function (helpful-buf)
|
||||
"Like `pop-to-buffer', but kill previous helpful buffers and save the new
|
||||
buffers `helpful--sym' to `my/helpful-symbol-history'."
|
||||
(cl-loop for buf in (buffer-list)
|
||||
with window = nil
|
||||
with last-index = nil
|
||||
(cl-loop with window = nil
|
||||
for buf in (buffer-list)
|
||||
when (and
|
||||
(not (eq buf helpful-buf))
|
||||
(eq (buffer-local-value 'major-mode buf) 'helpful-mode))
|
||||
do
|
||||
(when-let (cur-window (get-buffer-window buf nil))
|
||||
(setq window cur-window))
|
||||
(when-let (entry (buffer-local-value 'helpful--sym buf))
|
||||
(setq last-index (seq-position my/helpful-symbol-history entry 'equal)))
|
||||
(kill-buffer buf)
|
||||
finally
|
||||
(when-let ((entry (cons (buffer-local-value 'helpful--sym helpful-buf)
|
||||
(buffer-local-value 'helpful--callable-p
|
||||
helpful-buf)))
|
||||
((not (seq-contains-p my/helpful-symbol-history entry
|
||||
'equal))))
|
||||
(when last-index
|
||||
(let ((entry (cons (buffer-local-value 'helpful--sym helpful-buf)
|
||||
(buffer-local-value 'helpful--callable-p
|
||||
helpful-buf))))
|
||||
(unless my/-helpful-inhibit-history
|
||||
(when-let (from-current-hist
|
||||
(member my/-helpful-last-entry
|
||||
my/helpful-symbol-history))
|
||||
(setq my/helpful-symbol-history from-current-hist))
|
||||
(cl-pushnew entry my/helpful-symbol-history :test 'equal)
|
||||
(setq my/helpful-symbol-history
|
||||
(seq-drop my/helpful-symbol-history last-index)))
|
||||
(push entry my/helpful-symbol-history)
|
||||
(seq-take my/helpful-symbol-history my/helpful-symbol-history-size))
|
||||
(seq-take my/helpful-symbol-history
|
||||
my/helpful-symbol-history-size)))
|
||||
(setq my/-helpful-last-entry entry))
|
||||
(if window
|
||||
(window--display-buffer helpful-buf window 'reuse)
|
||||
(pop-to-buffer helpful-buf))))
|
||||
@ -1957,7 +1983,6 @@ one of the normal rainbow-delimiters-depth-N-face faces."
|
||||
|
||||
;; page break lines
|
||||
(use-package page-break-lines
|
||||
:hook (helpful-mode . page-break-lines-mode)
|
||||
:config
|
||||
(global-page-break-lines-mode 1)
|
||||
(add-to-list 'page-break-lines-modes 'prog-mode)
|
||||
|
Reference in New Issue
Block a user