emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Rasmus Pank Roulund <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]")
Date: Wed, 02 May 2018 18:12:16 +0100	[thread overview]
Message-ID: <87sh7a9e33.fsf@gmail.com> (raw)
In-Reply-To: <87lgd2whh9.fsf@gmx.us>

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

Hi Rasmus,

2018ko maiatzak 2an, Rasmus Pank Roulund-ek idatzi zuen:
>> Finally, irrespective of which options are chosen, I think that org-tempo
>> would be better implemented in terms of a minor mode.  This would allow
>> it to be autoloaded, turned on/off for different buffer(s) in an emacs
>> session, and avoid duplicating the logic for activating global minor
>> modes.  Patch attached.
> 
> I agree.

OK, thatʼs good to know.  Iʼve held off on any pushing of the patch to
master until everything is worked out.  In the meantime, Iʼve put it in
a branch “org-tempo”.

I also added a second commit to that branch which implements my vision
of the upgrade path (deprecation warnings, etc.)  For convenience, that
patch is also attached to this email.

One remaining decision to make is: what is the future of org-tempo?  I am
sympathetic to the idea that the best place for it eventually would be
org-contrib or GNU ELPA, and not org core.  If that is decided now, then
we can include that information in the upgrade message (i.e. that users
who opt in to org-tempo will eventually have to install it specifically).

-- 
Aaron Ecay

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Add-compatibility-code-to-org-tempo.patch --]
[-- Type: text/x-patch, Size: 2857 bytes --]

From 414503d59b2129c24e95e1e57b54d5662a17308b Mon Sep 17 00:00:00 2001
From: Aaron Ecay <aaronecay@gmail.com>
Date: Wed, 2 May 2018 17:48:18 +0100
Subject: [PATCH 2/2] Add compatibility code to org-tempo

This will warn users of <X style templates and prompt them to update
their .emacs if they want to continue using the feature.
---
 lisp/org-tempo.el | 40 +++++++++++++++++++++++++++++++++++++++-
 lisp/org.el       |  6 ++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/lisp/org-tempo.el b/lisp/org-tempo.el
index 2feed24dc..9923fe769 100644
--- a/lisp/org-tempo.el
+++ b/lisp/org-tempo.el
@@ -40,7 +40,6 @@
 
 (require 'tempo)
 (require 'cl-lib)
-(require 'org)
 
 (defvar org-structure-template-alist)
 
@@ -193,6 +192,45 @@ templates are defined."
 (define-global-minor-mode org-tempo-global-mode org-tempo-mode
   org-tempo-mode--activate-in-buffer)
 
+\f
+;;; Compatibility code
+
+;;; The code in this section can be removed in the next major release
+;;; after org-tempo was released (currently projected to land in Org
+;;; 9.2, therefore removal after Org 10).  At that time, the code
+;;; activating org-tempo-global-mode should also be removed from
+;;; org.el, and (require 'org) should be added to the top of this
+;;; file.
+
+(defvar org-tempo--user-activated nil
+  "This will be set to t when we detect that the user has
+activated org-tempo in their .emacs.")
+
+(advice-add 'org-tempo-global-mode :after
+	    (lambda (&rest _)
+	      (setq org-tempo--user-activated t)))
+
+;;; TODO: should we also try to detect the case when the user adds
+;;; org-tempo-mode to org-mode-hook?
+
+(advice-add 'org-tempo-complete-tag :after
+	    (lambda (&rest _)
+	      (unless org-tempo--user-activated
+		(org-display-warning
+		 (substitute-command-keys "It looks like you have \
+expanded a <X style structure template.
+
+That feature will be removed from Org in the next major release.
+If you would like to continue using it, you should
+add `(org-tempo-global-mode 1)' to your emacs initialization
+file (which will also disable this warning message).
+\\<org-mode-map>
+Alternatively, you may wish to use the new template expansion
+facility `org-insert-structure-template', which is bound to
+\\[org-insert-structure-template] in org-mode buffers.")))))
+
+\f
+
 (provide 'org-tempo)
 
 ;;; org-tempo.el ends here
diff --git a/lisp/org.el b/lisp/org.el
index 0b8e62357..c67c8d2c5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -23582,6 +23582,12 @@ when non-nil, is a regexp matching keywords names."
 	  (lambda () (add-hook 'change-major-mode-hook
 			       'org-show-all 'append 'local)))
 
+;; For compatibility; remove in Org 10
+(require 'org-tempo)
+(defvar org-tempo--user-activated)
+(let (org-tempo--user-activated)
+  (org-tempo-global-mode 1))
+
 (provide 'org)
 
 (run-hooks 'org-load-hook)
-- 
2.17.0


  reply	other threads:[~2018-05-02 17:12 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 10:24 [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]") Bastien
2018-04-29 10:50 ` Nicolas Goaziou
2018-04-29 11:05   ` Bastien
2018-04-29 12:01     ` Nicolas Goaziou
2018-04-29 13:22       ` Bastien
2018-04-29 17:40         ` Thomas S. Dye
2018-04-29 20:56           ` Bastien
2018-04-29 22:05             ` Tim Cross
2018-04-29 22:31               ` Bastien
2018-04-29 22:27         ` Tim Cross
2018-04-29 23:03           ` Bastien
2018-04-30 10:29             ` Nicolas Goaziou
2018-04-30 14:03               ` Kevin Foley
2018-04-30 14:17                 ` Kevin Foley
2018-05-05 17:20                 ` Rasmus
2018-05-02 12:43             ` Bernt Hansen
2018-05-08  6:23               ` Bastien
2018-05-05 17:17             ` Rasmus
2018-05-08  6:27               ` Bastien
2018-05-01 15:49           ` Aaron Ecay
2018-05-01 19:31             ` Eric S Fraga
2018-05-02  9:10             ` Rasmus Pank Roulund
2018-05-02 17:12               ` Aaron Ecay [this message]
2018-05-05 17:29                 ` Rasmus
2018-05-06 20:02                   ` Aaron Ecay
2018-05-07 22:53                     ` Rasmus
2018-05-08  0:57                       ` Aaron Ecay
2018-05-08  6:56                         ` Bastien
2018-05-21 14:24                         ` Rasmus
2018-05-08  6:52                   ` Bastien
2018-05-21 14:19                     ` Rasmus
2018-05-08  6:49                 ` Smooth transition for modules (was: [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]")) Bastien
2018-05-08  9:26                   ` Aaron Ecay
2018-05-08  9:46                     ` Smooth transition for modules Bastien
2018-05-08 13:28                       ` Aaron Ecay
2018-05-08  6:34             ` [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]") Bastien
2018-04-30  8:47         ` Eric S Fraga
2018-05-08  8:37       ` Bastien
2018-04-29 13:24     ` Christian Moe
2018-04-29 13:55     ` Charles Millar
2018-04-29 19:08     ` Diego Zamboni
2018-04-29 20:30       ` Rasmus
2018-04-29 20:44       ` Bastien
2018-04-29 23:32     ` Bernt Hansen
2018-05-02 20:24       ` Bernt Hansen
2018-05-03  9:44         ` Carsten Dominik
2018-05-03 13:30           ` William Denton
2018-05-04  7:34             ` Neil Jerram
2018-05-04  7:45               ` Bastien
2018-05-05  1:37                 ` Samuel Wales
2018-05-05  2:16                   ` Tim Cross
2018-05-05  2:28                     ` Samuel Wales
2018-05-05  2:37                       ` Tim Cross
2018-05-05 12:42                         ` Nicolas Goaziou
2018-05-05 17:33                     ` Rasmus
2018-05-01 11:57     ` Nick Helm
2018-04-29 20:25   ` Rasmus
2018-04-29 21:53     ` Nicolas Goaziou
2018-05-02  9:03       ` Rasmus
2018-04-30 16:36 ` Steve Downey
  -- strict thread matches above, loose matches on Subject: below --
2018-04-29 15:06 Jon Snader
2018-04-30 20:37 ` Richard Lawrence
2018-04-30 20:46   ` Peter Dewey Ore
2018-04-30 21:33     ` Michael Gauland
2018-04-30 21:46   ` Jon Snader
2018-04-30 22:25     ` Tim Cross
2018-04-30 22:35       ` Cook, Malcolm
2018-04-30 22:39       ` Jon Snader
2018-04-30 22:49         ` Kaushal Modi
2018-05-01  1:29           ` Alan Tyree
2018-05-01 14:07             ` Christophe Schockaert
2018-05-01  2:00         ` Tim Cross
2018-05-01  2:27           ` Steve Downey
2018-05-01 12:35             ` Nicolas Goaziou
2018-05-01 16:28               ` Aaron Ecay
2018-05-05 18:07                 ` Rasmus
2018-05-06 20:34                   ` Aaron Ecay
2018-05-06 22:11                     ` Tim Cross
2018-05-07 22:30                     ` Rasmus
2018-05-08  0:25                       ` Aaron Ecay
2018-05-08  7:36                         ` Bastien
2018-05-13 20:52                         ` Rasmus
2018-05-01 16:54               ` Cook, Malcolm
2018-05-05 18:01               ` Rasmus
2018-05-06  5:00                 ` Carsten Dominik
2018-05-07 22:33                   ` Rasmus
2018-05-08  7:37                 ` Bastien
2018-05-21 14:35                   ` Rasmus
2018-05-05 23:26               ` Adrian Bradd
2018-05-05 23:37                 ` Josiah Schwab
2018-05-08  7:31               ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sh7a9e33.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).