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: Sun, 21 Jul 2013 02:41:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Rasmus <rasmus@gmx.us> writes:

>
>   (defun rasmus/org-latex-ignore-heading (headline backend info)
>     "Strip headline from HEADLINE if it has tag ignoreheading."
>     (let* ((tags (org-element-property :tags
>                                        (plist-get 
>                                         (text-properties-at
>                                          (- (string-match "\n" headline) 2) 
> headline)
>                                         :parent))))
>       (when (and (member-ignore-case "ignoreheading" tags)
>                  (org-export-derived-backend-p backend 'latex 'ascii))
>         (string-match "\\`.*\n.*\n" headline)
>         (replace-match "" nil nil headline))))

This one is better.  It also doesn't make sense to remove headlines
for plain text as they also has structure like numbers

  (defun rasmus/org-latex-ignore-heading (headline backend info)
    "Strip headline from HEADLINE if it has tag ignoreheading."
    (when (org-export-derived-backend-p backend 'latex)
      (let ((tags (org-element-property :tags
                                        (plist-get
                                         (text-properties-at
                                          (or (string-match 
".?\\(\\\\hfill\\|}\n\\)" headline) 0) headline)
                                         :parent))))
        (when (and tags (member-ignore-case "ignoreheading" tags))
          (string-match "\\`.*\n.*\n" headline)
          (replace-match "" nil nil headline)))))

-- 
ツ




reply via email to

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