From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlos Pita Subject: Re: Feature request: simplify usage of special blocks (for beamer) Date: Sat, 1 Dec 2018 15:41:50 -0300 Message-ID: References: <87a7lpxfsc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTADL-00012d-Oh for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 13:42:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTADL-0001IU-1P for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 13:42:03 -0500 Received: from mail-yw1-xc2a.google.com ([2607:f8b0:4864:20::c2a]:43063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTADK-0001II-Tv for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 13:42:02 -0500 Received: by mail-yw1-xc2a.google.com with SMTP id l200so3766502ywe.10 for ; Sat, 01 Dec 2018 10:42:02 -0800 (PST) In-Reply-To: <87a7lpxfsc.fsf@gmail.com> 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 > > 1. Allow for special blocks to take an :options argument. > > Although I agree that this would be nice, I imagine the difficulty would be that it would be difficult to cater for multiple backends. It's not really difficult, more on the trivial side. For example, as an end user I already can install a filter like: (defun my-special-block-parse-filter (tree backend symbol) (when (org-export-derived-backend-p backend 'latex) (org-element-map tree 'special-block (lambda (element) (save-excursion (goto-char (org-element-property :begin element)) (when (looking-at "[ \t]*#\\+BEGIN_\\S-+[ \t]+\\(\\S-+\\)") (let ((options (format ":options [%s]" (match-string-no-properties 1)))) (org-element-put-property element :attr_latex (list options))))))))) And then write: #+BEGIN_definition Special Block A block mostly left uninterpreted by core org for the sake of backends #+END_definition This is as devoid of boilerplate as possible. Notice the filter only applies to latex derived backends and won't take effect if there is an #+ATTR_LATEX clause before the block (this because it's considered part of the element the regexp won't match it). Obviously this can be implemented in a cleaner way by changing org-latex-special-block in ox-latex.el. Again, the change would be trivial. > > 2. Mention the possibility of using special blocks to represent beamer > > blocks, be it in the manual or in the tutorial. > > Given that beamer inherits everything that the LaTeX exporter supports, is the special blocks section in the LaTeX exporter documentation not already enough? Not much users seem to be aware of the ablity of using special blocks for beamer. No example, answer, tutorial out there even mentioned the possibility. Given its convenience, I would say the beamer export section should explicitly suggest the alternative. Best regards -- Carlos