From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [patch] Check org-structure-template-alist Date: Sun, 27 May 2018 14:57:08 +0200 Message-ID: <87lgc52r4r.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMvEn-0004rh-Sj for emacs-orgmode@gnu.org; Sun, 27 May 2018 08:57:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMvEj-0001Wy-5R for emacs-orgmode@gnu.org; Sun, 27 May 2018 08:57:29 -0400 Received: from [195.159.176.226] (port=42636 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMvEi-0001S5-S1 for emacs-orgmode@gnu.org; Sun, 27 May 2018 08:57:25 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fMvCT-0000W8-9R for emacs-orgmode@gnu.org; Sun, 27 May 2018 14:55:05 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, Here’s a patch that would check org-structure-template-alist for the "old" format. It just pops a user-error if the old format is detected (it checks if the cdr of org-structure-template-alist entries is a list). On my system, binding max-mini-window-height seems to have no effect. My test window-total-height is 35. (let ((max-mini-window-height 15)) (message (mapconcat 'number-to-string (number-sequence 1 15) "\n"))) If there’s any better way to display the error or check if org-structure-template-alist is in the "old" format let me know. Rasmus -- Slowly unravels in a ball of yarn and the devil collects it --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Check-format-of-org-structure-template-alist.patch >From 7ae2fd392aaa5f76f65f4c88a0b1286167d6732a Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sun, 27 May 2018 14:44:49 +0200 Subject: [PATCH] Check format of org-structure-template-alist * org.el (org--check-org-structure-template-alist): New function yielding user-error if using old org-structure-template-alist format. (org--insert-structure-template-mks): * org-tempo.el (org-tempo-add-templates): Use new function --- lisp/org-tempo.el | 2 ++ lisp/org.el | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lisp/org-tempo.el b/lisp/org-tempo.el index b9a554ff7..a651c7b37 100644 --- a/lisp/org-tempo.el +++ b/lisp/org-tempo.el @@ -102,6 +102,8 @@ Tempo templates will be added." Go through `org-structure-template-alist' and `org-tempo-keywords-alist' and update tempo templates." + (mapc 'org--check-org-structure-template-alist '(org-structure-template-alist + org-tempo-keywords-alist)) (let ((keys (org-tempo--keys))) ;; Check for duplicated snippet keys and warn if any are found. (when (> (length keys) (length (delete-dups keys))) diff --git a/lisp/org.el b/lisp/org.el index b05acd78a..c67e91489 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11727,6 +11727,41 @@ block can be inserted by pressing TAB after the string \" len maxlen) + (format "... And %s other entries" (- len maxlen)) + ""))))) + (defun org--insert-structure-template-mks () "Present `org-structure-template-alist' with `org-mks'. @@ -11734,6 +11769,7 @@ Menus are added if keys require more than one keystroke. Tabs are added to single key entries when more than one stroke is needed. Keys longer than two characters are reduced to two characters." + (org--check-org-structure-template-alist) (let* (case-fold-search (templates (append org-structure-template-alist '(("\t" . "Press TAB, RET or SPC to write block name")))) -- 2.17.0 --=-=-=--