help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about string-match and match-string


From: Rasmus
Subject: Re: Question about string-match and match-string
Date: Thu, 18 Jul 2013 10:33:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>
>>  
>
> I'm also looking for a ignoreheading function and was looking forward to
> using yours.

As said, I'm pretty sure Nicholas posted it first!

>  However I get a (void-variable headline) error when exporting to
> LaTeX.


That's surprising.  First try the following, which I think will solve
the problem provided you're using org > 8 AND Emacs >24.4.    

;; add ignoreheading only after ox. 

(with-eval-after-load 'ox
  (defun rasmus/org-latex-ignore-heading (headline backend info)
    "Strip headline from HEADLINE if it has tag ignoreheading for
      certain headlines.  `info' is ignored"
    (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii 'odt)
               (string-match "\\`.*ignoreheading.*\n"
                             (downcase headline)))
      (replace-match "" nil nil headline)))  

  (add-to-list 'org-export-filter-headline-functions
               'rasmus/org-latex-ignore-heading))

With Emacs < 24.4 load with

(eval-after-load 'ox
  '(progn 
     (defun ...)
     (add-to-list ...)
     ))

In general with-eval-after-load is a wonderful function that can
really speed up things around start.  The function is what you'd
guess: it stores the information until a certain file (a string) or
feature (a symbol) is loaded and then evals the body.

You can also just put a (require 'ox) before the defun. 



If the above ain't working follow this recipe and let me know when the
error occurs.

   1. start Emacs by issuing emacs -q in the terminal (don't load config)
   2. in the *scratch* buffer type (require 'org) (shouldn't be
      necessary, actually).
   3. Type M-x org-version RET and check that it's greater than 8.
      E.g. my output it:
         Org-mode version 8.0.3 (release_8.0.3-309-gabacff @
         /usr/share/emacs/site-lisp/org/)
   4. Load the filter above
   5. type C-x b test.org RET M-x org-mode RET
   6. input 
      * test :ignoreheading:
       test-text
   7. type C-x C-e lL

On my system this gives the desired output.  Can you reproduce?

-- 
May contains speling mistake




reply via email to

[Prev in Thread] Current Thread [Next in Thread]