From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rasmus Newsgroups: gmane.emacs.help Subject: Re: Question about string-match and match-string Date: Sun, 21 Jul 2013 02:41:49 +0200 Message-ID: <87siz8lp6a.fsf@gmx.us> References: <20130717081704.GB16899@kuru.dyndns-at-home.com> <20130717083511.GC16899@kuru.dyndns-at-home.com> <87sizdbmo2.fsf@gmx.us> <874nbsb8lw.fsf@free.fr> <87ppug469b.fsf@gmx.us> <874nbp8d6u.fsf@free.fr> <87d2qcuavi.fsf@gmx.us> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1374367332 30227 80.91.229.3 (21 Jul 2013 00:42:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Jul 2013 00:42:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 21 02:42:13 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V0hj3-00035S-7o for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Jul 2013 02:42:13 +0200 Original-Received: from localhost ([::1]:32799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0hj2-0003tC-Pp for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Jul 2013 20:42:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0his-0003t7-4y for help-gnu-emacs@gnu.org; Sat, 20 Jul 2013 20:42:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0hir-00040E-4J for help-gnu-emacs@gnu.org; Sat, 20 Jul 2013 20:42:02 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:57298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0hiq-000400-Tm for help-gnu-emacs@gnu.org; Sat, 20 Jul 2013 20:42:01 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V0hip-0002zw-AR for help-gnu-emacs@gnu.org; Sun, 21 Jul 2013 02:41:59 +0200 Original-Received: from g225142123.adsl.alicedsl.de ([92.225.142.123]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jul 2013 02:41:59 +0200 Original-Received: from rasmus by g225142123.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jul 2013 02:41:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g225142123.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAAAmJLR0QA/4ePzL8AAAAJcEhZ cwAAAEgAAABIAEbJaz4AAADHSURBVEjH7VXBEQMhCLQiOqEYSqEOuqEhkseduRMk8MlkJtnnysqC imP8NIBEnxD0JFMQT3ZCpwRkcrzGs11wbAhXTu7xYuYUdOck9vNS4MpdXa1rpjDUkRAXcGxHATcF frMYZwooxhvuSt6B457uId8r4K6g3aX2OVRPWufVwGaCYtmcPKCsRVVF/qg9grmBSa8UwskkZTtz DoVJBJLxRyX3WRKFtzOWSu43Cq7NcSzadwqq/xXU8DMvivT+IzXoCZDGHx/EA6ex0LZqsBZsAAAA AElFTkSuQmCC Cancel-Lock: sha1:h+nbXoklpqToazXj2CExNXdvHKM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92283 Archived-At: Rasmus 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))))) -- ツ