BREAKING CHANGE: This removes git-gutter as an implementation for the `:ui vc-gutter` module, leaving only the diff-hl implementation. There are no longer any +git-gutter or +diff-hl flags for this module. Users don't have to do anything to keep the vc gutter, unless they prefer git-gutter for any reason (in which case they'll need to install and set it up themselves). This has been planned for some time, because of a roadmap goal for Doom to lean into native/built-in functionality where it's equal or better than the third party alternatives. diff-hl relies on the built-in vc.el library instead of talking to git directly (thus expanding support to whatever VCS's vc.el supports, and not git alone), which also means it can take advantage of its caching and other user configuration for vc.el. Overall, it is faster and lighter. What I've also been waiting for was a stage-hunk command, similar to git-gutter:stage-hunk, which arrived in dgutov/diff-hl@a0560551cd and dgutov/diff-hl@133538973b, and have evolved since. Ref: dgutov/diff-hl@a0560551cd Ref: dgutov/diff-hl@133538973b Ref: https://github.com/orgs/doomemacs/projects/5/views/1?pane=issue&itemId=58747789
54 lines
2 KiB
EmacsLisp
54 lines
2 KiB
EmacsLisp
;;; lang/org/autoload/org-export.el -*- lexical-binding: t; -*-
|
|
|
|
(defun +org--yank-html-buffer (buffer)
|
|
(with-current-buffer buffer
|
|
(require 'ox-clip)
|
|
(cond ((or (featurep :system 'windows)
|
|
(featurep :system 'macos))
|
|
(shell-command-on-region
|
|
(point-min)
|
|
(point-max)
|
|
(cond ((featurep :system 'windows) ox-clip-w32-cmd)
|
|
((featurep :system 'macos) ox-clip-osx-cmd))))
|
|
((featurep :system 'linux)
|
|
(let ((html (buffer-string)))
|
|
(with-temp-file (make-temp-file "ox-clip-md" nil ".html")
|
|
(insert html))
|
|
(apply #'start-process "ox-clip" "*ox-clip*"
|
|
(split-string ox-clip-linux-cmd " ")))))))
|
|
|
|
|
|
;;
|
|
;;; Commands
|
|
|
|
;;;###autoload
|
|
(defun +org/export-to-clipboard (backend)
|
|
"Exports the current buffer/selection to the clipboard.
|
|
|
|
Prompts for what BACKEND to use. See `org-export-backends' for options."
|
|
(interactive
|
|
(list (intern (completing-read "Export to: " (progn (require 'ox) org-export-backends)))))
|
|
(require 'ox)
|
|
(let* ((org-export-show-temporary-export-buffer nil)
|
|
(buffer (org-export-to-buffer backend "*Formatted Copy*" nil nil t t)))
|
|
(unwind-protect
|
|
(with-current-buffer buffer
|
|
(kill-new (buffer-string)))
|
|
(kill-buffer buffer))))
|
|
|
|
;;;###autoload
|
|
(defun +org/export-to-clipboard-as-rich-text (beg end)
|
|
"Export the current buffer to HTML then copies it to clipboard as rich text.
|
|
|
|
Supports org-mode, markdown-mode, and gfm-mode buffers. In any other mode,
|
|
htmlize is used (takes what you see in Emacs and converts it to html, text
|
|
properties and font-locking et all)."
|
|
(interactive "r")
|
|
(pcase major-mode
|
|
((or `markdown-mode `gfm-mode)
|
|
(+org--yank-html-buffer (markdown)))
|
|
(_
|
|
;; Omit after/before-string overlay properties in htmlized regions, so we
|
|
;; don't get fringe characters for things like flycheck or diff-hl
|
|
(letf! (defun htmlize-add-before-after-strings (_beg _end text) text)
|
|
(ox-clip-formatted-copy beg end)))))
|