浏览代码

org-tempo: Fix obnoxious `ding' when expanding templates

* lisp/org-tempo.el (org-tempo-complete-tag): New function.

Reported-by: Brent Goodrick <bgoodr@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00080.html>
Nicolas Goaziou 7 年之前
父节点
当前提交
6791fd29d3
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      lisp/org-tempo.el

+ 9 - 1
lisp/org-tempo.el

@@ -121,6 +121,14 @@ Goes through `org-structure-template-alist' and
 			   (format "Insert a %s keyword" name)
 			   'org-tempo-tags)))
 
+(defun org-tempo-complete-tag (&rest _)
+  "Look for a tag and expand it silently.
+Unlike to `tempo-complete-tag', do not give a signal if a partial
+completion or no match at all is found.  Return nil if expansion
+didn't succeed."
+  (cl-letf (((symbol-function 'ding) #'ignore))
+    (tempo-complete-tag t)))
+
 ;;; Additional keywords
 
 (defun org-tempo--include-file ()
@@ -153,7 +161,7 @@ Goes through `org-structure-template-alist' and
 
 (add-hook 'org-mode-hook 'org-tempo-setup)
 (add-hook 'org-tab-before-tab-emulation-hook
-	  'tempo-complete-tag)
+	  'org-tempo-complete-tag)
 
 ;; Enable Org Tempo in all open Org buffers.
 (dolist (b (org-buffer-list))