emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] [PATCH] org-mtags: remove
@ 2014-06-14 22:25 Aaron Ecay
  2014-06-22  0:51 ` Aaron Ecay
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Ecay @ 2014-06-14 22:25 UTC (permalink / raw)
  To: emacs-orgmode

* contrib/lisp/org-mtags.el: Delete file.
* lisp/org.el (org-structure-template-alist): Remove <foo>-style tags.
(org-complete-expand-structure-template): Don't handle <foo>-style tags.
---
 contrib/lisp/org-mtags.el | 255 ----------------------------------------------
 lisp/org.el               |  43 ++++----
 2 files changed, 20 insertions(+), 278 deletions(-)
 delete mode 100644 contrib/lisp/org-mtags.el

The recent discussion of org-structure-template-alist[1] made me take
a look at that variable, and I realized it includes infrastructure for
an outdated method of using <foo>-style tags instead of canonical org
syntax.  The implementation in contrib was never updated to the new
exporter, and the approach seems out of line with the goals of that
project.  So this patch removes this extension from core and contrib.

Does anyone have an opinion on whether this is a good idea?

Thanks,
Aaron

[1] http://mid.gmane.org/87egz0sbfc.fsf@gmail.com

diff --git a/contrib/lisp/org-mtags.el b/contrib/lisp/org-mtags.el
deleted file mode 100644
index 5342184..0000000
--- a/contrib/lisp/org-mtags.el
+++ /dev/null
@@ -1,255 +0,0 @@
-;;; org-mtags.el --- Muse-like tags in Org-mode
-
-;; Copyright (C) 2008-2014 Free Software Foundation, Inc.
-;;
-;; Author: Carsten Dominik <carsten at orgmode dot org>
-;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: http://orgmode.org
-;; Version: 0.01
-;;
-;; This file is not yet part of GNU Emacs.
-;;
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;; Commentary:
-;;
-;; This modules implements some of the formatting tags available in
-;; Emacs Muse.  This is not a way if adding new functionality, but just
-;; a different way to write some formatting directives.  The advantage is
-;; that files written in this way can be read by Muse reasonably well,
-;; and that this provides an alternative way of writing formatting
-;; directives in Org, a way that some might find more pleasant to type
-;; and look at that the Org's #+BEGIN..#+END notation.
-
-;; The goal of this development is to make it easier for people to
-;; move between both worlds as they see fit for different tasks.
-
-;; The following muse tags will be translated during export into their
-;; native Org equivalents:
-;;
-;;   <br>
-;;        Needs to be at the end of a line.  Will be translated to "\\".
-;;
-;;   <example switches="-n -r">
-;;        Needs to be on a line by itself, similarly the </example> tag.
-;;        Will be translated into Org's #+BEGIN_EXAMPLE construct.
-;;
-;;   <quote>
-;;        Needs to be on a line by itself, similarly the </quote> tag.
-;;        Will be translated into Org's #+BEGIN_QUOTE construct.
-;;
-;;   <comment>
-;;        Needs to be on a line by itself, similarly the </comment> tag.
-;;        Will be translated into Org's #+BEGIN_COMMENT construct.
-;;
-;;   <verse>
-;;        Needs to be on a line by itself, similarly the </verse> tag.
-;;        Will be translated into Org's #+BEGIN_VERSE construct.
-;;
-;;   <contents>
-;;        This gets translated into "[TABLE-OF-CONTENTS]".  It will not
-;;        trigger the production of a table of contents - that is done
-;;        in Org with the "#+OPTIONS: toc:t" setting.  But it will define
-;;        the location where the TOC will be placed.
-;;
-;;   <literal style="STYLE">    ;; only latex, html, and docbook supported
-;;        in Org.
-;;        Needs to be on a line by itself, similarly the </literal> tag.
-;;
-;;   <src lang="LANG" switches="-n -r">
-;;        Needs to be on a line by itself, similarly the </src> tag.
-;;        Will be translated into Org's BEGIN_SRC construct.
-;;
-;;   <include file="FILE" markup="MARKUP" lang="LANG"
-;;            prefix="str" prefix1="str" switches="-n -r">
-;;        Needs to be on a line by itself.
-;;        Will be translated into Org's #+INCLUDE construct.
-;;
-;; The lisp/perl/ruby/python tags can be implemented using the
-;; `org-eval.el' module, which see.
-
-(require 'org)
-
-;;; Customization
-
-(defgroup org-mtags nil
-  "Options concerning Muse tags in Org mode."
-  :tag "Org Muse Tags"
-  :group 'org)
-
-(defface org-mtags    ; similar to shadow
-  (org-compatible-face 'shadow
-    '((((class color grayscale) (min-colors 88) (background light))
-       (:foreground "grey50"))
-      (((class color grayscale) (min-colors 88) (background dark))
-       (:foreground "grey70"))
-      (((class color) (min-colors 8) (background light))
-       (:foreground "green"))
-      (((class color) (min-colors 8) (background dark))
-       (:foreground "yellow"))))
-  "Face for Muse-like tags in Org."
-  :group 'org-mtags
-  :group 'org-faces)
-
-(defcustom org-mtags-prefer-muse-templates t
-  "Non-nil means prefere Muse tags for structure elements.
-This is relevane when expanding the templates defined in the variable
-`org-structure-templates'."
-  :group 'org-mtags
-  :type 'boolean)
-
-(defconst org-mtags-supported-tags
-  '("example" "quote" "comment" "verse" "contents" "literal" "src" "include")
-  "The tags that are supported by org-mtags.el for conversion.
-In addition to this list, the <br> tag is supported as well.")
-
-(defconst org-mtags-fontification-re
-  (concat
-   "^[ \t]*</?\\("
-   (mapconcat 'identity org-mtags-supported-tags "\\|")
-   "\\)\\>[^>]*>\\|<br>[ \t]*$")
-  "Regular expression used for fontifying muse tags.")
-
-(defun org-mtags-replace ()
-  "Replace Muse-like tags with the appropriate Org constructs.
-The is done in the entire buffer."
-  (interactive) ;; FIXME
-  (let ((re (concat "^[ \t]*\\(</?\\("
-		    (mapconcat 'identity org-mtags-supported-tags "\\|")
-		    "\\)\\>\\)"))
-	info tag rpl style markup lang file prefix prefix1 switches)
-    ;; First, do the <br> tag
-    (goto-char (point-min))
-    (while (re-search-forward "<br>[ \t]*$" nil t)
-      (replace-match "\\\\" t t))
-    ;; Now, all the other tags
-    (goto-char (point-min))
-    (while (re-search-forward re nil t)
-      (goto-char (match-beginning 1))
-      (setq info (org-mtags-get-tag-and-attributes))
-      (if (not info)
-	  (end-of-line 1)
-	(setq tag (plist-get info :tag))
-	(cond
-	 ((equal tag "contents")
-	  (setq rpl "[TABLE-OF-CONTENTS]")
-	  ;; FIXME: also trigger TOC in options-plist?????
-	  )
-	 ((member tag '("quote" "comment" "verse"))
-	  (if (plist-get info :closing)
-	      (setq rpl (format "#+END_%s" (upcase tag)))
-	    (setq rpl (format "#+BEGIN_%s" (upcase tag)))))
-	 ((equal tag "literal")
-	  (setq style (plist-get info :style))
-	  (and style (setq style (downcase style)))
-	  (if (plist-get info :closing)
-	      (setq rpl (cond
-			 ((member style '("latex"))
-			  "#+END_LaTeX")
-			 ((member style '("html"))
-			  "#+END_HTML")
-			 ((member style '("docbook"))
-			  "#+END_DOCBOOK")
-			 ((member style '("ascii"))
-			  "#+END_ASCII")))
-	    (setq rpl (cond
-		       ((member style '("latex"))
-			"#+BEGIN_LaTeX")
-		       ((member style '("html"))
-			"#+BEGIN_HTML")
-		       ((member style '("ascii"))
-			"#+BEGIN_ASCII")))))
-	 ((equal tag "example")
-	  (if (plist-get info :closing)
-	      (setq rpl "#+END_EXAMPLE")
-	    (setq rpl "#+BEGIN_EXAMPLE")
-	    (when (setq switches (plist-get info :switches))
-	      (setq rpl (concat rpl " " switches)))))
-	 ((equal tag "src")
-	  (if (plist-get info :closing)
-	      (setq rpl "#+END_SRC")
-	    (setq rpl "#+BEGIN_SRC")
-	    (when (setq lang (plist-get info :lang))
-	      (setq rpl (concat rpl " " lang))
-	      (when (setq switches (plist-get info :switches))
-		(setq rpl (concat rpl " " switches))))))
-	 ((equal tag "include")
-	  (setq file (plist-get info :file)
-		markup (downcase (plist-get info :markup))
-		lang (plist-get info :lang)
-		prefix (plist-get info :prefix)
-		prefix1 (plist-get info :prefix1)
-		switches (plist-get info :switches))
-	  (setq rpl "#+INCLUDE")
-	  (setq rpl (concat rpl " " (prin1-to-string file)))
-	  (when markup
-	    (setq rpl (concat rpl " " markup))
-	    (when (and (equal markup "src") lang)
-	      (setq rpl (concat rpl " " lang))))
-	  (when prefix
-	    (setq rpl (concat rpl " :prefix " (prin1-to-string prefix))))
-	  (when prefix1
-	    (setq rpl (concat rpl " :prefix1 " (prin1-to-string prefix1))))
-	  (when switches
-	    (setq rpl (concat rpl " " switches)))))
-	(when rpl
-	  (goto-char (plist-get info :match-beginning))
-	  (delete-region (point-at-bol) (plist-get info :match-end))
-	  (insert rpl))))))
-
-(defun org-mtags-get-tag-and-attributes ()
-  "Parse a Muse-like tag at point ant rturn the information about it.
-The return value is a property list which contains all the attributes
-with string values.  In addition, it reutnrs the following properties:
-
-:tag              The tag as a string.
-:match-beginning  The beginning of the match, just before \"<\".
-:match-end        The end of the match, just after \">\".
-:closing          t when the tag starts with \"</\"."
-  (when (looking-at "<\\(/\\)?\\([a-zA-Z]+\\>\\)\\([^>]*\\)>")
-    (let ((start 0)
-	  tag rest prop attributes endp val)
-      (setq tag (org-match-string-no-properties 2)
-	    endp (match-end 1)
-	    rest (and (match-end 3)
-		      (org-match-string-no-properties 3))
-	    attributes (list :tag tag
-			     :match-beginning (match-beginning 0)
-			     :match-end (match-end 0)
-			     :closing endp))
-      (when rest
-	(while (string-match "\\([a-zA-Z]+\\)=\\([^ \t\n>]+\\|\"[^>]+\"\\)"
-			     rest start)
-	  (setq start (match-end 0)
-		prop (org-match-string-no-properties 1 rest)
-		val (org-remove-double-quotes
-		     (org-match-string-no-properties 2 rest)))
-	  (setq attributes (plist-put attributes
-				      (intern (concat ":" prop)) val))))
-      attributes)))
-
-(defun org-mtags-fontify-tags (limit)
-  "Fontify the muse-like tags."
-  (while (re-search-forward org-mtags-fontification-re limit t)
-    (add-text-properties (match-beginning 0) (match-end 0)
-			 '(face org-mtags font-lock-multiline t
-				font-lock-fontified t))))
-
-(add-hook 'org-export-preprocess-hook 'org-mtags-replace)
-(add-hook 'org-font-lock-hook 'org-mtags-fontify-tags)
-
-(provide 'org-mtags)
-
-;;; org-mtags.el ends here
diff --git a/lisp/org.el b/lisp/org.el
index 322efd2..6a59566 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12244,27 +12244,24 @@ keywords relative to each registered export back-end."
     "TITLE:" "TODO:" "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:"))

 (defcustom org-structure-template-alist
-  '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src lang=\"?\">\n\n</src>")
-    ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" "<example>\n?\n</example>")
-    ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE" "<quote>\n?\n</quote>")
-    ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" "<verse>\n?\n</verse>")
-    ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM" "<verbatim>\n?\n</verbatim>")
-    ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" "<center>\n?\n</center>")
-    ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX"
-     "<literal style=\"latex\">\n?\n</literal>")
-    ("L" "#+LaTeX: " "<literal style=\"latex\">?</literal>")
-    ("h" "#+BEGIN_HTML\n?\n#+END_HTML"
-     "<literal style=\"html\">\n?\n</literal>")
-    ("H" "#+HTML: " "<literal style=\"html\">?</literal>")
-    ("a" "#+BEGIN_ASCII\n?\n#+END_ASCII" "")
-    ("A" "#+ASCII: " "")
-    ("i" "#+INDEX: ?" "#+INDEX: ?")
-    ("I" "#+INCLUDE: %file ?"
-     "<include file=%file markup=\"?\">"))
+  '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
+    ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
+    ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
+    ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE")
+    ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
+    ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER")
+    ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX")
+    ("L" "#+LaTeX: ")
+    ("h" "#+BEGIN_HTML\n?\n#+END_HTML")
+    ("H" "#+HTML: ")
+    ("a" "#+BEGIN_ASCII\n?\n#+END_ASCII")
+    ("A" "#+ASCII: ")
+    ("i" "#+INDEX: ?")
+    ("I" "#+INCLUDE: %file ?"))
   "Structure completion elements.
 This is a list of abbreviation keys and values.  The value gets inserted
 if you type `<' followed by the key and then press the completion key,
-usually `M-TAB'.  %file will be replaced by a file name after prompting
+usually `TAB'.  %file will be replaced by a file name after prompting
 for the file using completion.  The cursor will be placed at the position
 of the `?` in the template.
 There are two templates for each key, the first uses the original Org syntax,
@@ -12275,8 +12272,9 @@ variable `org-mtags-prefer-muse-templates'."
   :type '(repeat
 	  (list
 	   (string :tag "Key")
-	   (string :tag "Template")
-	   (string :tag "Muse Template"))))
+	   (string :tag "Template")))
+  :version 24.4
+  :package-version ("Org" . "8.3"))

 (defun org-try-structure-completion ()
   "Try to complete a structure template before point.
@@ -12293,9 +12291,8 @@ expands them."

 (defun org-complete-expand-structure-template (start cell)
   "Expand a structure template."
-  (let* ((musep (org-bound-and-true-p org-mtags-prefer-muse-templates))
-	 (rpl (nth (if musep 2 1) cell))
-	 (ind ""))
+  (let ((rpl (nth 1 cell))
+	(ind ""))
     (delete-region start (point))
     (when (string-match "\\`[ \t]*#\\+" rpl)
       (cond
--
2.0.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] [PATCH] org-mtags: remove
  2014-06-14 22:25 [RFC] [PATCH] org-mtags: remove Aaron Ecay
@ 2014-06-22  0:51 ` Aaron Ecay
  2014-06-22  6:38   ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Ecay @ 2014-06-22  0:51 UTC (permalink / raw)
  To: emacs-orgmode

2014ko ekainak 14an, Aaron Ecay-ek idatzi zuen:
> 
> * contrib/lisp/org-mtags.el: Delete file.
> * lisp/org.el (org-structure-template-alist): Remove <foo>-style tags.
> (org-complete-expand-structure-template): Don't handle <foo>-style tags.
> ---
>  contrib/lisp/org-mtags.el | 255 ----------------------------------------------
>  lisp/org.el               |  43 ++++----
>  2 files changed, 20 insertions(+), 278 deletions(-)
>  delete mode 100644 contrib/lisp/org-mtags.el
> 
> The recent discussion of org-structure-template-alist[1] made me take
> a look at that variable, and I realized it includes infrastructure for
> an outdated method of using <foo>-style tags instead of canonical org
> syntax.  The implementation in contrib was never updated to the new
> exporter, and the approach seems out of line with the goals of that
> project.  So this patch removes this extension from core and contrib.
> 
> Does anyone have an opinion on whether this is a good idea?
> 
> Thanks,
> Aaron
> 
> [1] http://mid.gmane.org/87egz0sbfc.fsf@gmail.com

I pushed this patch to master, since there was no feedback.  It can be
reverted if it causes any problems, of course (and if you notice it
does, please feel free to revert it yourself).

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] [PATCH] org-mtags: remove
  2014-06-22  0:51 ` Aaron Ecay
@ 2014-06-22  6:38   ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2014-06-22  6:38 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Hi Aaron,

sorry for the lack of feedback on this -- I don't have enough time
right now.

Aaron Ecay <aaronecay@gmail.com> writes:

> I pushed this patch to master, since there was no feedback.  It can be
> reverted if it causes any problems, of course (and if you notice it
> does, please feel free to revert it yourself).

I don't expect any problem, thanks for taking care of this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-22  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-14 22:25 [RFC] [PATCH] org-mtags: remove Aaron Ecay
2014-06-22  0:51 ` Aaron Ecay
2014-06-22  6:38   ` Bastien

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).