Skip to content

Commit

Permalink
Revert "Remove useless yas-expand maybe hook"
Browse files Browse the repository at this point in the history
This reverts commit d875ac7.
  • Loading branch information
HyunggyuJang committed Jul 29, 2024
1 parent 3e1ecad commit 781165c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
64 changes: 32 additions & 32 deletions modules/lang/org/autoload/org.el
Original file line number Diff line number Diff line change
Expand Up @@ -476,38 +476,38 @@ Made for `org-tab-first-hook' in evil-mode."
(call-interactively #'tab-to-tab-stop)
t)))

;; ###autoload
;; (defun +org-yas-expand-maybe-h ()
;; "Expand a yasnippet snippet, if trigger exists at point or region is active.
;; Made for `org-tab-first-hook'."
;; (when (and (modulep! :editor snippets)
;; (bound-and-true-p yas-minor-mode))
;; (and (let ((major-mode (cond ((org-in-src-block-p t)
;; (org-src-get-lang-mode (org-eldoc-get-src-lang)))
;; ((get-char-property (point) 'aas)
;; '+latex-utility)
;; (major-mode)))
;; (org-src-tab-acts-natively nil) ; causes breakages
;; ;; Smart indentation doesn't work with yasnippet, and painfully slow
;; ;; in the few cases where it does.
;; (yas-indent-line 'fixed))
;; (cond ((and (or (not (bound-and-true-p evil-local-mode))
;; (evil-insert-state-p)
;; (evil-emacs-state-p))
;; (or (and (bound-and-true-p yas--tables)
;; (gethash major-mode yas--tables))
;; (progn (yas-reload-all) t))
;; (yas--templates-for-key-at-point))
;; (yas-expand)
;; t)
;; ((use-region-p)
;; (yas-insert-snippet)
;; t)))
;; ;; HACK Yasnippet breaks org-superstar-mode because yasnippets is
;; ;; overzealous about cleaning up overlays.
;; (when (bound-and-true-p org-superstar-mode)
;; (org-superstar-restart))
;; )))
;;;###autoload
(defun +org-yas-expand-maybe-h ()
"Expand a yasnippet snippet, if trigger exists at point or region is active.
Made for `org-tab-first-hook'."
(when (and (modulep! :editor snippets)
(bound-and-true-p yas-minor-mode))
(and (let ((major-mode (cond ((org-in-src-block-p t)
(org-src-get-lang-mode (org-eldoc-get-src-lang)))
((get-char-property (point) 'aas)
'+latex-utility)
(major-mode)))
(org-src-tab-acts-natively nil) ; causes breakages
;; Smart indentation doesn't work with yasnippet, and painfully slow
;; in the few cases where it does.
(yas-indent-line 'fixed))
(cond ((and (or (not (bound-and-true-p evil-local-mode))
(evil-insert-state-p)
(evil-emacs-state-p))
(or (and (bound-and-true-p yas--tables)
(gethash major-mode yas--tables))
(progn (yas-reload-all) t))
(yas--templates-for-key-at-point))
(yas-expand)
t)
((use-region-p)
(yas-insert-snippet)
t)))
;; HACK Yasnippet breaks org-superstar-mode because yasnippets is
;; overzealous about cleaning up overlays.
;; (when (bound-and-true-p org-superstar-mode)
;; (org-superstar-restart))
)))

;;;###autoload
(defun +org-cycle-only-current-subtree-h (&optional arg)
Expand Down
2 changes: 1 addition & 1 deletion modules/lang/org/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ between the two."
org-insert-heading-respect-content t)

(add-hook! 'org-tab-first-hook
;; #'+org-yas-expand-maybe-h
#'+org-yas-expand-maybe-h
#'+org-indent-maybe-h)

(add-hook 'doom-delete-backward-functions
Expand Down

0 comments on commit 781165c

Please sign in to comment.