Inital 31.1 changes
This commit is contained in:
@@ -1,311 +0,0 @@
|
||||
;;; corfu-terminal-popupinfo.el --- corfu-popupinfo support in the terminal -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; To make use of this file, simply `require' it, and then enable
|
||||
;; `corfu-terminal-popupinfo-mode', which is a global mode. Note that
|
||||
;; `corfu-terminal-mode' MUST be loaded and enabled for this to work.
|
||||
|
||||
;;; Code:
|
||||
(require 'popon)
|
||||
(require 'corfu-terminal)
|
||||
(require 'corfu-popupinfo)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar ctp--popon nil
|
||||
"The current popon, or nil if there is none.")
|
||||
|
||||
(defvar ctp--buffer nil
|
||||
"The buffer holding the current candidate's documentation.")
|
||||
|
||||
(defun ctp--get-buffer ()
|
||||
"Create or return `ctp--buffer'."
|
||||
(unless (and (bufferp ctp--buffer) (buffer-live-p ctp--buffer))
|
||||
(setq ctp--buffer (generate-new-buffer " *corfu-terminal-popupinfo*" t)))
|
||||
ctp--buffer)
|
||||
|
||||
(defun ctp--visible-p ()
|
||||
"Return non-nil if the terminal popup window is visible."
|
||||
(popon-live-p ctp--popon))
|
||||
|
||||
(defun ctp--corfu-popupinfo--visible-p-advice (oldfun &optional frame)
|
||||
"Advice for `corfu-popupinfo--visible-p'.
|
||||
If FRAME is nil, this will return `ctp--visible-p'. If
|
||||
FRAME is `corfu--frame', this will return weather the `corfu-terminal--popon' is
|
||||
live or not.
|
||||
|
||||
As this is :around advice, OLDFUN is the real (advised) function to call."
|
||||
(cond
|
||||
((and (not frame) (ctp--visible-p)))
|
||||
((and (eq frame corfu--frame) (popon-live-p corfu-terminal--popon)))
|
||||
((funcall oldfun frame))))
|
||||
|
||||
(defun ctp--close ()
|
||||
"Close the popon."
|
||||
(popon-kill ctp--popon)
|
||||
(setq ctp--popon nil))
|
||||
|
||||
(defalias 'ctp--corfu-popupinfo--hide-advice 'ctp--close
|
||||
"Advice for `corfu-popupinfo--hide' that works in the terminal.")
|
||||
|
||||
(defun ctp--load-content (candidate buffer)
|
||||
"Load the documentation for CANDIDATE into BUFFER."
|
||||
(when-let* ((content (funcall corfu-popupinfo--function candidate)))
|
||||
;; A bunch of this comes straight from `corfu-popupinfo--show'
|
||||
(with-current-buffer buffer
|
||||
(dolist (var corfu-popupinfo--buffer-parameters)
|
||||
(set (make-local-variable (car var)) (cdr var)))
|
||||
(with-silent-modifications
|
||||
(erase-buffer)
|
||||
(insert content)
|
||||
;; popon.el requires that each line be of the same width. As we are in
|
||||
;; the terminal, we assume that each character is the same width (and
|
||||
;; we can't do anything, or even know, if this is not the case). Thus,
|
||||
;; we run over the buffer to pad out each line to the width of the
|
||||
;; longest line.
|
||||
(goto-char (point-min))
|
||||
(let ((wrap-p (and (not truncate-lines) word-wrap))
|
||||
(longest-line 0))
|
||||
(cl-block nil
|
||||
(while (not (eobp))
|
||||
(let ((len (- (pos-eol) (pos-bol))))
|
||||
(when (> len longest-line)
|
||||
(setq longest-line len))
|
||||
(when (and wrap-p (> longest-line corfu-popupinfo-max-width))
|
||||
(setq longest-line corfu-popupinfo-max-width)
|
||||
(cl-return)))
|
||||
(forward-line)))
|
||||
(setq-local fill-column longest-line)
|
||||
(when wrap-p
|
||||
(fill-region (point-min) (point-max)))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(end-of-line)
|
||||
(let ((len (- (point) (pos-bol))))
|
||||
(when (< len longest-line)
|
||||
(insert (make-string (- longest-line len) ? ))))
|
||||
(forward-line))))
|
||||
(goto-char (point-min))
|
||||
(put-text-property (point-min) (point-max) 'face 'corfu-popupinfo)
|
||||
(when-let* ((m (memq 'corfu-default (alist-get 'default face-remapping-alist))))
|
||||
(setcar m 'corfu-popupinfo)))
|
||||
;; We succeeded in loading the data
|
||||
t))
|
||||
|
||||
(defun ctp--popon-position (buffer)
|
||||
"Find a good position to open the popon for BUFFER's content.
|
||||
Return a list of the position, the max line length that can be shown, and the
|
||||
max height that can be shown. Each line of BUFFER _MUST_ be the same lenght."
|
||||
(when-let* ((point-posn (posn-at-point))
|
||||
(point-x (car (posn-x-y point-posn)))
|
||||
(point-y (cdr (posn-x-y point-posn))))
|
||||
(with-current-buffer buffer
|
||||
(when-let* ((completion-pos (popon-position corfu-terminal--popon))
|
||||
(completion-size (popon-size corfu-terminal--popon))
|
||||
(comp-x (car completion-pos))
|
||||
(comp-y (cdr completion-pos))
|
||||
(comp-w (car completion-size))
|
||||
(comp-h (cdr completion-size))
|
||||
(win-w (window-max-chars-per-line))
|
||||
(win-h (window-body-height))
|
||||
(line-len (- (pos-eol) (pos-bol)))
|
||||
(num-lines (count-lines (point-min) (point-max))))
|
||||
(let* ((align 'row)
|
||||
(width (min line-len corfu-popupinfo-max-width))
|
||||
(pop-x (cond
|
||||
((<= (+ comp-x comp-w width) win-w)
|
||||
(+ comp-x comp-w))
|
||||
((>= (- comp-x width) 0)
|
||||
(- comp-x width))
|
||||
((<= (+ comp-x width) win-w)
|
||||
(setq align 'col)
|
||||
comp-x)
|
||||
((>= (- win-w width) 0)
|
||||
(setq align 'col)
|
||||
(- win-w width))
|
||||
(t
|
||||
(setq align 'col
|
||||
width win-w)
|
||||
0)))
|
||||
(height (min num-lines corfu-popupinfo-max-height))
|
||||
(pop-y (cl-case align
|
||||
(row (if (<= (+ comp-y height) win-h)
|
||||
comp-y
|
||||
(max 0 (- win-h height))))
|
||||
(col (cond
|
||||
((<= (+ comp-y comp-h height)
|
||||
(- win-h scroll-margin))
|
||||
(+ comp-y comp-h))
|
||||
;; If the completion dialog is above the point
|
||||
((and (< comp-y point-y)
|
||||
(>= (- comp-y height) 0))
|
||||
(- comp-y height))
|
||||
;; Emacs seems to hide the current text if this
|
||||
;; number is 1 (I think it's too close to two
|
||||
;; overlays)
|
||||
((>= (- comp-y height 2) 0)
|
||||
(- comp-y height 2))
|
||||
(t (+ comp-y comp-h)))))))
|
||||
(list (cons pop-x pop-y) width height))))))
|
||||
|
||||
(defun ctp--extract-content (buffer width height)
|
||||
"Extract the content from BUFFER for a popon.
|
||||
The content extracted is for a popon of size WIDTH by HEIGHT."
|
||||
(let (start end)
|
||||
(with-current-buffer buffer
|
||||
;; we assume that we are scrolled to the start of the region we care about
|
||||
(save-excursion
|
||||
(let ((rem-lines (count-lines (point) (point-max))))
|
||||
(when (< rem-lines height)
|
||||
(forward-line (- rem-lines height))))
|
||||
(setq start (point)
|
||||
end (pos-eol height))))
|
||||
(with-temp-buffer
|
||||
(insert-buffer-substring buffer start end)
|
||||
(goto-char (point-min))
|
||||
(cl-loop repeat height
|
||||
until (eobp) do
|
||||
(let ((len (- (pos-eol) (pos-bol))))
|
||||
(when (> len width)
|
||||
(delete-region (+ (pos-bol) width) (pos-eol))))
|
||||
(forward-line))
|
||||
;; "delete" the rest of the lines
|
||||
(narrow-to-region (point-min) (point))
|
||||
(buffer-string))))
|
||||
|
||||
(defun ctp--display-buffer (buffer)
|
||||
"Display or redisplay BUFFER in a popon."
|
||||
(let ((inhibit-redisplay t))
|
||||
(cl-destructuring-bind (&optional pos width height)
|
||||
(ctp--popon-position buffer)
|
||||
(popon-kill ctp--popon)
|
||||
(when-let* ((pos)
|
||||
(content (ctp--extract-content buffer width height)))
|
||||
(setq ctp--popon
|
||||
;; appear behind the auto-complete window, in case something
|
||||
;; happens
|
||||
(popon-create content pos nil nil 100))))))
|
||||
|
||||
(defun ctp--corfu-popupinfo--show-advice (oldfun candidate)
|
||||
"Advice for `corfu-popupinfo--show' that works in the terminal.
|
||||
CANDIDATE is the same as for `corfu-popupinfo--show'. As this is meant to be
|
||||
:around advice, OLDFUN is assumed to be the real (advised) function."
|
||||
(if (display-graphic-p)
|
||||
(progn
|
||||
(popon-kill ctp--popon)
|
||||
(funcall oldfun candidate))
|
||||
(when corfu-popupinfo--timer
|
||||
(cancel-timer corfu-popupinfo--timer)
|
||||
(setq corfu-popupinfo--timer nil))
|
||||
(when (and (frame-live-p corfu-popupinfo--frame)
|
||||
(frame-visible-p corfu-popupinfo--frame))
|
||||
(corfu--hide-frame corfu-popupinfo--frame))
|
||||
(when (or (not (ctp--visible-p))
|
||||
(not (equal-including-properties
|
||||
candidate corfu-popupinfo--candidate)))
|
||||
(let ((buf (ctp--get-buffer)))
|
||||
(if (ctp--load-content candidate buf)
|
||||
(progn
|
||||
(ctp--display-buffer buf)
|
||||
(setq corfu-popupinfo--candidate candidate
|
||||
corfu-popupinfo--toggle t))
|
||||
(corfu-popupinfo--hide))))))
|
||||
|
||||
(defun ctp--move-away-from-eob ()
|
||||
"Ensure the point isn't too close to the end of the buffer."
|
||||
(if-let* ((total-lines (count-lines (point-min) (point-max)))
|
||||
((> total-lines corfu-popupinfo-max-height))
|
||||
(rem-lines (count-lines (point) (point-max)))
|
||||
((< rem-lines corfu-popupinfo-max-height)))
|
||||
(forward-line (- (- corfu-popupinfo-max-height rem-lines)))))
|
||||
|
||||
(defun ctp--corfu-popupinfo-scroll-up-advice
|
||||
(oldfun &optional n)
|
||||
"Advice for `corfu-popupinfo-scroll-up'.
|
||||
N is the number of lines. As this is :around advice, OLDFUN is the real
|
||||
\(advised) function."
|
||||
(if (ctp--visible-p)
|
||||
(let ((buf (ctp--get-buffer)))
|
||||
(with-current-buffer buf
|
||||
(forward-line n)
|
||||
(beginning-of-line)
|
||||
(ctp--move-away-from-eob))
|
||||
(ctp--display-buffer buf))
|
||||
(funcall oldfun n)))
|
||||
|
||||
(defun ctp--corfu-popupinfo-end-advice (oldfun &optional n)
|
||||
"Advice for `corfu-popupinfo-end'.
|
||||
N is the same as for `corfu-popupinfo-end'. As this is :around advice, OLDFUN
|
||||
is the real (advised) function."
|
||||
(if (ctp--visible-p)
|
||||
(let ((buf (ctp--get-buffer)))
|
||||
(with-current-buffer buf
|
||||
(let ((size (- (point-max) (point-min))))
|
||||
(goto-char (if n
|
||||
(- (point-max) (/ (* size n) 10))
|
||||
(point-max))))
|
||||
(beginning-of-line)
|
||||
(ctp--move-away-from-eob))
|
||||
(ctp--display-buffer buf))
|
||||
(funcall oldfun n)))
|
||||
|
||||
(defun ctp--corfu--popup-hide-advice ()
|
||||
":after advice for `corfu--popup-hide'."
|
||||
(unless completion-in-region-mode
|
||||
(ctp--close)))
|
||||
|
||||
(defun ctp--enable ()
|
||||
"Enable corfu terminal popupinfo by advising some corfu functions."
|
||||
(advice-add 'corfu-popupinfo--visible-p :around
|
||||
'ctp--corfu-popupinfo--visible-p-advice)
|
||||
(advice-add 'corfu-popupinfo--hide :after
|
||||
'ctp--corfu-popupinfo--hide-advice)
|
||||
(advice-add 'corfu-popupinfo--show :around
|
||||
'ctp--corfu-popupinfo--show-advice)
|
||||
(advice-add 'corfu-popupinfo-scroll-up :around
|
||||
'ctp--corfu-popupinfo-scroll-up-advice)
|
||||
(advice-add 'corfu-popupinfo-end :around
|
||||
'ctp--corfu-popupinfo-end-advice)
|
||||
(advice-add 'corfu--popup-hide :after
|
||||
'ctp--corfu--popup-hide-advice))
|
||||
|
||||
(defun ctp--disable ()
|
||||
"Disable corfu terminal popupinfo by remove advice added by `ctp--enable'."
|
||||
(ctp--close)
|
||||
(advice-remove 'corfu-popupinfo--visible-p
|
||||
'ctp--corfu-popupinfo--visible-p-advice)
|
||||
(advice-remove 'corfu-popupinfo--hide
|
||||
'ctp--corfu-popupinfo--hide-advice)
|
||||
(advice-remove 'corfu-popupinfo--show
|
||||
'ctp--corfu-popupinfo--show-advice)
|
||||
(advice-remove 'corfu-popupinfo-scroll-up
|
||||
'ctp--corfu-popupinfo-scroll-up-advice)
|
||||
(advice-remove 'corfu-popupinfo-end
|
||||
'ctp--corfu-popupinfo-end-advice)
|
||||
(advice-remove 'corfu--popup-hide
|
||||
'ctp--corfu--popup-hide-advice))
|
||||
|
||||
(defun ctp--corfu-terminal-mode-hook ()
|
||||
"Hook run from `corfu-terminal-mode-hook'."
|
||||
(if (and corfu-terminal-mode
|
||||
(bound-and-true-p corfu-terminal-popupinfo-mode))
|
||||
(ctp--enable)
|
||||
(ctp--disable)))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode corfu-terminal-popupinfo-mode
|
||||
"Minor mode shows the `corfu-popupinfo-mode' popup in the terminal.
|
||||
Note that even with this enabled, you still need to enable the actual popup
|
||||
using `corfu-popupinfo-toggle'. Also, this does not do anything if
|
||||
`corfu-terminal-mode' is not enabled."
|
||||
:global t
|
||||
:group 'corfu-terminal-popupinfo
|
||||
(if corfu-terminal-popupinfo-mode
|
||||
(progn
|
||||
(add-hook 'corfu-terminal-mode-hook 'ctp--corfu-terminal-mode-hook)
|
||||
(when corfu-terminal-mode
|
||||
(ctp--enable)))
|
||||
(remove-hook 'corfu-terminal-mode-hook 'ctp--corfu-terminal-mode-hook)
|
||||
(ctp--disable)))
|
||||
|
||||
(provide 'corfu-terminal-popupinfo)
|
||||
;;; corfu-terminal-popupinfo.el ends here
|
||||
@@ -54,7 +54,7 @@ These should end with a slash (/) if their are a directory."
|
||||
ARGS are passed uncaged to Firejail and should include the proper debug command."
|
||||
(ignore-error file-missing
|
||||
(mapcan (lambda (line)
|
||||
(when (string-match (rx "- " (group (+ any)) eol) line)
|
||||
(when (string-match (rx "- " (group (+ not-newline)) eol) line)
|
||||
(list (match-string 1 line))))
|
||||
(apply 'process-lines firejail-executable args))))
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ languages supported by this interpreter."))
|
||||
(defun inf-cc--remove-surrounding-parens (str)
|
||||
"Remove surrounding parenthesis from STR."
|
||||
(if (string-match (rx bos (* (syntax whitespace)) "("
|
||||
(group (* any))
|
||||
(group (* not-newline))
|
||||
")" (* (syntax whitespace)) eos)
|
||||
str)
|
||||
(match-string 1 str)
|
||||
|
||||
+2
-2
@@ -90,7 +90,7 @@ PROC and STR are described in `set-process-filter'."
|
||||
(concat (string-join errors "\n") "\n")))))
|
||||
(process-send-string proc "y\n")
|
||||
(process-send-string proc "n\n")))
|
||||
((string-match (rx bos "Error: " (group (+ any)) eol) line)
|
||||
((string-match (rx bos "Error: " (group (+ not-newline)) eol) line)
|
||||
(push (match-string 1 line) errors)))))
|
||||
(with-editor-process-filter proc str t))
|
||||
|
||||
@@ -178,7 +178,7 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
|
||||
(when (and (message-point-in-header-p)
|
||||
(message-beginning-of-header t))
|
||||
(beginning-of-line)
|
||||
(when (and (looking-at (rx bol (group (+? any)) ":" (? " ")))
|
||||
(when (and (looking-at (rx bol (group (+? not-newline)) ":" (? " ")))
|
||||
(funcall (or testfn 'equal) (match-string 1) name))
|
||||
(match-end 0)))))
|
||||
|
||||
|
||||
+15
-15
@@ -272,9 +272,9 @@ FOUND is the hash table in which to put the entries."
|
||||
while dir
|
||||
when (file-directory-p dir) do
|
||||
(let ((files (directory-files dir t)))
|
||||
(if (cl-member-if (lambda (file)
|
||||
(latex-help--is-marker-file file root))
|
||||
files)
|
||||
(if (member-if (lambda (file)
|
||||
(latex-help--is-marker-file file root))
|
||||
files)
|
||||
;; dir is an entry
|
||||
(puthash (file-name-nondirectory dir) nil found)
|
||||
;; search all subdirs
|
||||
@@ -295,7 +295,7 @@ FOUND is the hash table in which to put the entries."
|
||||
(goto-char (point-min))
|
||||
(forward-line 2)
|
||||
(cl-loop while (re-search-forward (rx bol (+ " ") "active" "\t"
|
||||
(group (+ any)) eol) nil t)
|
||||
(group (+ not-newline)) eol) nil t)
|
||||
collect (match-string 1))))
|
||||
|
||||
(defun latex-help--texdoc-config-file-entries (file found)
|
||||
@@ -359,7 +359,7 @@ prompting with `completing-read'."
|
||||
"\t"
|
||||
(? (+ (not "\t")))
|
||||
"\t"
|
||||
(group (* any))))
|
||||
(group (* not-newline))))
|
||||
nil t)
|
||||
for file = (match-string 1)
|
||||
for desc = (match-string 2)
|
||||
@@ -424,8 +424,8 @@ This is done by parsing the index for `latex-help-info-manual'."
|
||||
(group (or
|
||||
","
|
||||
(+ (not (any " " "{" ",")))))
|
||||
(*? any) ":" (+ " ")
|
||||
(group (+? any)) ".")))))
|
||||
(*? not-newline) ":" (+ " ")
|
||||
(group (+? not-newline)) ".")))))
|
||||
(push (list "(SPACE)" "\\(SPACE)") found)
|
||||
(when-let* ((entry (assoc "(...\\)" found)))
|
||||
(setq found (assoc-delete-all "(...\\)" found))
|
||||
@@ -441,20 +441,20 @@ This is done by parsing the index for `latex-help-info-manual'."
|
||||
"Discover LaTeX packages.
|
||||
This is done by parsing the index for `latex-help-info-manual'."
|
||||
(latex-help--run-index-search (rx (and bol "* package, "
|
||||
(group (+? any))
|
||||
(group (+? not-newline))
|
||||
(any " " ":")
|
||||
(+? any) (+ " ")
|
||||
(group (+? any))
|
||||
(+? not-newline) (+ " ")
|
||||
(group (+? not-newline))
|
||||
"."))))
|
||||
|
||||
(defun latex-help--discover-environments ()
|
||||
"Discover LaTeX environments.
|
||||
This is done by parsing the index for `latex-help-info-manual'."
|
||||
(latex-help--run-index-search (rx (and bol "* environment, "
|
||||
(group (+? any))
|
||||
(group (+? not-newline))
|
||||
(any " " ":" "-")
|
||||
(+? any) (+ " ")
|
||||
(group (+? any))
|
||||
(+? not-newline) (+ " ")
|
||||
(group (+? not-newline))
|
||||
"."))))
|
||||
|
||||
(defun latex-help--discover-classes ()
|
||||
@@ -589,7 +589,7 @@ from the texdoc cache."
|
||||
(car prompts)))))
|
||||
(when (string-match (rx bos "(" (group (+ (any (?a . ?z))
|
||||
(any (?A . ?Z))))
|
||||
") " (group (* any)))
|
||||
") " (group (* not-newline)))
|
||||
selected)
|
||||
(if (equal (match-string 1 selected) "Info")
|
||||
(cons (assoc (match-string 2 selected) (cdr info-entry)) 'info)
|
||||
@@ -670,7 +670,7 @@ Prompt the user for an info topic or texdoc file, then open that thing."
|
||||
(if (string-prefix-p "(Texdoc) " ans)
|
||||
(latex-help-texdoc (seq-subseq ans (length "(Texdoc) ")))
|
||||
(string-match (rx "(Info) " (group (+ (not " ")))
|
||||
" - " (group (+ any)))
|
||||
" - " (group (+ not-newline)))
|
||||
ans)
|
||||
(when-let* ((thing (match-string 2 ans))
|
||||
(type (intern (downcase (match-string 1 ans))))
|
||||
|
||||
@@ -76,16 +76,16 @@ about this change."
|
||||
(when (and
|
||||
(re-search-forward (rx bol (literal mail-header-separator) eol)
|
||||
nil t)
|
||||
(re-search-forward (rx "<#multipart" (* any) ">")
|
||||
(re-search-forward (rx "<#multipart" (* not-newline) ">")
|
||||
nil t)
|
||||
(re-search-forward (rx "<#part " (* any)
|
||||
"type=" (literal type) (* any) ">")
|
||||
(re-search-forward (rx "<#part " (* not-newline)
|
||||
"type=" (literal type) (* not-newline) ">")
|
||||
nil t))
|
||||
(let ((start (match-end 0))
|
||||
(end (point-max)))
|
||||
(when (re-search-forward
|
||||
(rx (or (and "<#/" (or "part" "multipart") ">")
|
||||
(and "<#part" (* any) ">")))
|
||||
(and "<#part" (* not-newline) ">")))
|
||||
nil t)
|
||||
(setq end (match-beginning 0)))
|
||||
(cons (1+ start) end)))))
|
||||
@@ -347,7 +347,7 @@ This returns a hash table of cid -> path."
|
||||
(goto-char (match-beginning 1))
|
||||
(let ((start (point))
|
||||
(src (read (current-buffer))))
|
||||
(when-let ((file (gethash (substring src 4) cid-map)))
|
||||
(when-let* ((file (gethash (substring src 4) cid-map)))
|
||||
(delete-region start (point))
|
||||
(insert (prin1-to-string (concat "file://" file))))))))))
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
(require 'sh-script)
|
||||
(require 'treesit)
|
||||
(require 'rx)
|
||||
(require 'xref)
|
||||
|
||||
(defgroup zsh-ts-mode nil
|
||||
"Tree-sitter powered Zsh editing."
|
||||
@@ -238,9 +239,9 @@ command.")
|
||||
(defun zsh-ts-mode--defun-name (node)
|
||||
"If NODE is a defun node, return its name.
|
||||
This behaves according to `treesit-defun-name-function'."
|
||||
(when-let ((node)
|
||||
(res (treesit-query-capture node zsh-ts-mode--defun-name-query
|
||||
nil nil t)))
|
||||
(when-let* ((node)
|
||||
(res (treesit-query-capture node zsh-ts-mode--defun-name-query
|
||||
nil nil t)))
|
||||
(treesit-node-text (car res) t)))
|
||||
|
||||
(defun zsh-ts-mode--imenu-predicate (node)
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
;; Use melpa
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
;; Safer package upgrades
|
||||
(setopt package-review-policy '(not (archive . "gnu") (archive . "nongnu")))
|
||||
(package-initialize)
|
||||
|
||||
;; Ensure use-package is installed
|
||||
@@ -628,6 +630,7 @@ directory. Otherwise, run `find-file' on that file."
|
||||
(require 'mozc nil t)
|
||||
(setq default-input-method "japanese-mozc")
|
||||
(with-eval-after-load 'mozc
|
||||
(defvar mozc-candidate-style)
|
||||
(require 'mozc-posframe)
|
||||
(setq mozc-candidate-style 'posframe))
|
||||
|
||||
@@ -1249,6 +1252,7 @@ environment variable accordingly."
|
||||
(not (eq (current-local-map)
|
||||
read-passwd-map)))))
|
||||
:config
|
||||
(defvar corfu--extra)
|
||||
(defun my/corfu-move-to-minibuffer ()
|
||||
(interactive)
|
||||
(when completion-in-region--data
|
||||
@@ -1276,12 +1280,6 @@ environment variable accordingly."
|
||||
(apply oldfun args)))
|
||||
(advice-add 'corfu-popupinfo--get-documentation :around
|
||||
'my/-corfu-popupinfo-close-help-buffer))
|
||||
(use-package corfu-terminal
|
||||
:init
|
||||
(corfu-terminal-mode 1)
|
||||
:config
|
||||
(require 'corfu-terminal-popupinfo)
|
||||
(corfu-terminal-popupinfo-mode 1))
|
||||
|
||||
(use-package dabbrev
|
||||
:ensure nil
|
||||
@@ -1411,7 +1409,7 @@ If BUFFER is nil, the current buffer is used."
|
||||
"Return a list of error strings describing the Racket errors at point."
|
||||
(let (out)
|
||||
(dolist (ov (overlays-at (point)))
|
||||
(when-let ((face (overlay-get ov 'face)))
|
||||
(when-let* ((face (overlay-get ov 'face)))
|
||||
(cl-case face
|
||||
(racket-xp-error-face
|
||||
(when-let* ((help-echo (get-text-property (point) 'help-echo)))
|
||||
@@ -2396,8 +2394,7 @@ line in the block and manually deal with indentation."
|
||||
:hook (lisp-mode . my/-format-only-when-sly-running)
|
||||
:init
|
||||
(defun my/-apheleia-sly-skip-function ()
|
||||
(or (not (featurep 'sly))
|
||||
(not sly-mode)
|
||||
(or (not (bound-and-true-p sly-mode))
|
||||
(not (sly-connected-p))))
|
||||
(defun my/-format-only-when-sly-running ()
|
||||
"Make apheleia-mode format lisp buffers only when sly is running."
|
||||
@@ -2412,7 +2409,7 @@ line in the block and manually deal with indentation."
|
||||
(inferior-lisp-program "/usr/bin/sbcl")
|
||||
:init
|
||||
(defun my/-sly-fix-special-buffers ()
|
||||
(when (string-match-p (rx bos "*" (* any) "*" eos) (buffer-name))
|
||||
(when (string-match-p (rx bos "*" (* not-newline) "*" eos) (buffer-name))
|
||||
(setq-local show-trailing-whitespace nil)))
|
||||
(add-hook 'lisp-mode-hook 'my/-sly-fix-special-buffers)
|
||||
:config
|
||||
@@ -2665,7 +2662,7 @@ Note that this erases the buffer before doing anything."
|
||||
"Return a Jupyter buffer that can evaluate the code MODE is editing.
|
||||
MODE defaults to `major-mode'."
|
||||
(when-let* ((name (symbol-name (or mode major-mode)))
|
||||
((string-match (rx bos (group (+? any)) (? "-ts") "-mode" eos)
|
||||
((string-match (rx bos (group (+? not-newline)) (? "-ts") "-mode" eos)
|
||||
name)))
|
||||
(my/-find-jupyter-buffer-for-lang (match-string 1 name))))
|
||||
|
||||
@@ -2888,7 +2885,7 @@ argument."
|
||||
(defun my/dir-container-p (&optional dir)
|
||||
"Return non-nil if DIR is a remote directory that is a container.
|
||||
Actually, return the method name."
|
||||
(car (member (file-remote-p default-directory 'method)
|
||||
(car (member (file-remote-p (or dir default-directory) 'method)
|
||||
'("docker" "podman" "kubernetes" "dockercp" "podmancp"
|
||||
"toolbox" "distrobox" "flatpak" "apptainer" "nspawn"))))
|
||||
(defun my/dir-distrobox-p (&optional dir)
|
||||
@@ -3093,7 +3090,7 @@ Actually, return the method name."
|
||||
If no name is given, list all bookmarks instead."
|
||||
(if name
|
||||
(progn
|
||||
(string-match (rx bos (group (* (not "/"))) (* "/") (group (* any)))
|
||||
(string-match (rx bos (group (* (not "/"))) (* "/") (group (* not-newline)))
|
||||
name)
|
||||
(let* ((bm-name (match-string 1 name))
|
||||
(after-path (match-string 2 name))
|
||||
@@ -3128,7 +3125,7 @@ If no name is given, list all bookmarks instead."
|
||||
(let ((arg (pcomplete-arg)))
|
||||
(if (not (cl-find ?/ arg))
|
||||
(pcomplete-here (mapcar (##concat % "/") (bookmark-all-names)))
|
||||
(when (string-match (rx bos (group (+ (not "/"))) (+ "/") (group (* any)))
|
||||
(when (string-match (rx bos (group (+ (not "/"))) (+ "/") (group (* not-newline)))
|
||||
arg)
|
||||
(let ((bm-name (match-string 1 arg))
|
||||
(after-path (match-string 2 arg)))
|
||||
@@ -3443,7 +3440,7 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
|
||||
(when (and (message-point-in-header-p)
|
||||
(message-beginning-of-header t))
|
||||
(beginning-of-line)
|
||||
(when (and (looking-at (rx bol (group (+? any)) ":" (? " ")))
|
||||
(when (and (looking-at (rx bol (group (+? not-newline)) ":" (? " ")))
|
||||
(funcall (or testfn 'equal) (match-string 1) name))
|
||||
(match-end 0)))))
|
||||
|
||||
@@ -3473,7 +3470,7 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
|
||||
This is the same as `evil-ret' except that it works for links in
|
||||
`mu4e-view-mode'."
|
||||
:type line
|
||||
(if-let ((url (get-text-property (point) 'mu4e-url)))
|
||||
(if-let* ((url (get-text-property (point) 'mu4e-url)))
|
||||
(mu4e--view-browse-url-from-binding url)
|
||||
(funcall-interactively #'evil-ret count)))
|
||||
(defun my/-mu4e-setup-view-mode ()
|
||||
|
||||
Reference in New Issue
Block a user