From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: org-e-latex: ignoreheading is not working any more. Date: Wed, 21 Nov 2012 15:15:08 +0000 Message-ID: <878v9vhts3.fsf@gmail.com> References: <8739032640.fsf@yagnesh.org>, <87a9ubi134.fsf@gmail.com>, <87r4nndrca.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbC15-0007d1-Fq for emacs-orgmode@gnu.org; Wed, 21 Nov 2012 10:15:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbC0y-0003Ax-Sd for emacs-orgmode@gnu.org; Wed, 21 Nov 2012 10:15:07 -0500 Received: from mail-wi0-f177.google.com ([209.85.212.177]:33701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbC0y-0003Am-Lt for emacs-orgmode@gnu.org; Wed, 21 Nov 2012 10:15:00 -0500 Received: by mail-wi0-f177.google.com with SMTP id c10so1459107wiw.12 for ; Wed, 21 Nov 2012 07:14:59 -0800 (PST) In-reply-to: <87r4nndrca.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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: Yagnesh Raghava Yakkala , emacs-orgmode@gnu.org Hi Nicolas, Nicolas Goaziou writes: > Hello, > > Myles English writes: > >> Hi Yagnesh, >> >> Yagnesh Raghava Yakkala writes: >>> I have been using example setting suggested by Nicolas >>> (http://article.gmane.org/gmane.emacs.orgmode/55972) to tell exporter to skip >>> particular headline (with ignoreheading tag). >>> >>> It seems recent commit made this setup obsolete. could anybody suggest me the >>> alternative setting for this.? > > There are only two changes: > > #+BEGIN_SRC emacs-lisp > (add-to-list 'org-e-latex-translate-table '(headline . my-e-latex-headline)) > #+END_SRC > > is obsolete since `org-e-latex-translate-table' variable has been > removed. If you want to install a new translator, you have to create > a derived back-end, which is easy (see the example at the end of that > link). > > Also, the hook will now be called with an argument: the back-end used as > a symbol. > > Otherwise, the thread is still valid. > >> I've been using this, (I notice it is significantly longer than the >> example in the link above so it may be overkill): >> >> #+BEGIN_SRC emacs-lisp >> (defun my-export-delete-headlines-tagged-noheading(heading-text) >> "Goto headline `heading-text'" >> (let ((wasfound t)) >> (while wasfound >> (progn (org-element-map >> (org-element-parse-buffer 'headline) >> 'headline >> (lambda (x) >> (if (member "noheading" (org-element-property :tags x)) >> (progn >> (goto-char (org-element-property :begin x)) >> (delete-region (point) >> (progn >> (forward-line 1) >> (point))) >> (goto-char (point-min))) >> (setq wasfound nil))) >> nil >> t)) ;; stop at first find, >> nil) ;; start again from the top of the buffer >> (goto-char (point-min)))) >> >> (add-to-list 'org-export-before-processing-hook >> 'my-export-delete-headlines-tagged-noheading) >> #+END_SRC > > Each time you delete an headline, you parse the full buffer again, so, > yes, it will be slow. You can simply reverse list returned by > `org-element-map' (but don't stop at first find) and walk that list, > deleting matching headlines along the way. [kicks self] > #+begin_src emacs-lisp > (defun my-export-delete-headlines-tagged-noheading (backend) > (dolist (hl (nreverse (org-element-map (org-element-parse-buffer 'headline) > 'headline > 'identity))) > (when (member "noheading" (org-element-property :tags hl)) > (goto-char (org-element-property :begin hl)) > (delete-region (point) (progn (forward-line) (point)))))) > #+end_src > > Another option is to use `org-map-entries', which doesn't require to > reverse the results (and doesn't use Org Element). This is left as an > exercise. Thank you, there is lots of useful stuff to learn from in your reply, as always. Myles