From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Lower-casing blocks and keywords Date: Wed, 24 Jan 2018 15:21:27 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="089e0823d720338d680563873846" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeMrs-0007O7-9O for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 10:21:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeMrr-0007eX-4k for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 10:21:40 -0500 Received: from mail-yb0-x233.google.com ([2607:f8b0:4002:c09::233]:39498) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeMrr-0007eF-0S for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 10:21:39 -0500 Received: by mail-yb0-x233.google.com with SMTP id 65so1655122ybz.6 for ; Wed, 24 Jan 2018 07:21:38 -0800 (PST) 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: Nicolas Goaziou , emacs-org list --089e0823d720338d680563873846 Content-Type: text/plain; charset="UTF-8" Hello Nicolas, I also like the blocks and keywords to be lower-cased. I see this in the latest commit on master: https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 Did you do that lower-casing by hand? Or do you have an elisp snippet or some script that does that? Thanks. -- Kaushal Modi --089e0823d720338d680563873846 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Nicolas,

I also like the= blocks and keywords to be lower-cased. I see this in the latest commit on = master: https://code.orgmode.org/bzg/org-mode/commit= /13424336a6f30c50952d291e7a82906c1210daf0

Did you do that = lower-casing by hand? Or do you have an elisp snippet or some script that d= oes that?

Thanks.
--

Kaushal Mo= di

--089e0823d720338d680563873846-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Lower-casing blocks and keywords Date: Wed, 24 Jan 2018 16:18:08 +0000 Message-ID: <87607rs01r.fsf@delle7240.chemeng.ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeNkf-00049B-No for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeNka-0007It-Pz for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:18:17 -0500 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:34971) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeNka-0007Ho-Hv for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:18:12 -0500 Received: by mail-wm0-x22c.google.com with SMTP id r78so9714348wme.0 for ; Wed, 24 Jan 2018 08:18:12 -0800 (PST) In-Reply-To: (Kaushal Modi's message of "Wed, 24 Jan 2018 15:21:27 +0000") 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: Kaushal Modi Cc: emacs-org list , Nicolas Goaziou --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wednesday, 24 Jan 2018 at 15:21, Kaushal Modi wrote: > Did you do that lower-casing by hand? Or do you have an elisp snippet or > some script that does that? I have no idea how Nicolas did the changes but, remember, org has the full power of Emacs behind it (it's all text ;-)) so a simple query-replace-regexp (or without query) using an appropriate regex to catch all directives will do the job? =2D-=20 Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-352-g92176c --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSPXCedOQfhSlwpVw3IkZPY//z2fQUCWmixwAAKCRDIkZPY//z2 fci1AJ9Dk8emslgcRj5eNGS+JVDDd4l/vQCfcBAZelB1okW7G0vmD2Q7WH5OMP8= =Iw6J -----END PGP SIGNATURE----- --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Lower-casing blocks and keywords Date: Wed, 24 Jan 2018 16:19:33 +0000 Message-ID: <871sifrzze.fsf@delle7240.chemeng.ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeNm2-0005AZ-LW for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:19:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeNlx-0008Fa-Pn for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:19:42 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:40774) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeNlx-0008Ez-K3 for emacs-orgmode@gnu.org; Wed, 24 Jan 2018 11:19:37 -0500 Received: by mail-wm0-x232.google.com with SMTP id v123so9673664wmd.5 for ; Wed, 24 Jan 2018 08:19:37 -0800 (PST) In-Reply-To: (Kaushal Modi's message of "Wed, 24 Jan 2018 15:21:27 +0000") 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: Kaushal Modi Cc: emacs-org list , Nicolas Goaziou --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ignore previous email. Slightly misread your request. Not as trivial... ;= -) =2D-=20 Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-352-g92176c --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSPXCedOQfhSlwpVw3IkZPY//z2fQUCWmiyFgAKCRDIkZPY//z2 ffp7AKCOymAElm3adCPPDrYTb90wH7pLxwCglEJjT23Va//QyCqtSI9FnujhV1w= =kaQn -----END PGP SIGNATURE----- --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Lower-casing blocks and keywords Date: Thu, 25 Jan 2018 21:17:42 +0100 Message-ID: <874ln9u1zt.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eenxx-00073D-HR for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 15:17:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eenxw-0001yb-HK for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 15:17:45 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:52329) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eenxw-0001xP-Ar for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 15:17:44 -0500 In-Reply-To: (Kaushal Modi's message of "Wed, 24 Jan 2018 15:21:27 +0000") 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: Kaushal Modi Cc: emacs-org list Hello, Kaushal Modi writes: > I also like the blocks and keywords to be lower-cased. I see this in the > latest commit on master: > https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 > > Did you do that lower-casing by hand? Or do you have an elisp snippet or > some script that does that? IIRC, this was grep then eyeball and a macro to automatically convert a line. Regards, -- Nicolas Goaziou 0x80A93738 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Lower-casing blocks and keywords Date: Fri, 02 Feb 2018 16:56:55 +0000 Message-ID: References: <874ln9u1zt.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c0660b43fc6d405643d9a99" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehefG-0000cs-VE for emacs-orgmode@gnu.org; Fri, 02 Feb 2018 11:59:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eheeC-0003DR-R7 for emacs-orgmode@gnu.org; Fri, 02 Feb 2018 11:58:14 -0500 Received: from mail-yw0-x233.google.com ([2607:f8b0:4002:c05::233]:45082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eheeC-0003D4-B3 for emacs-orgmode@gnu.org; Fri, 02 Feb 2018 11:57:08 -0500 Received: by mail-yw0-x233.google.com with SMTP id b16so10830089ywh.12 for ; Fri, 02 Feb 2018 08:57:07 -0800 (PST) In-Reply-To: <874ln9u1zt.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: emacs-org list --94eb2c0660b43fc6d405643d9a99 Content-Type: text/plain; charset="UTF-8" On Thu, Jan 25, 2018 at 3:17 PM Nicolas Goaziou wrote: > > I also like the blocks and keywords to be lower-cased. I see this in the > > latest commit on master: > > > https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 > > > > Did you do that lower-casing by hand? Or do you have an elisp snippet or > > some script that does that? > > IIRC, this was grep then eyeball and a macro to automatically convert > a line. > I got back to this task at hand, and this elisp command works just fine (based on export testing of a bunch of Org files). Let me know if I missed out on something (or did over-lower-casing) :) (defun modi/lower-case-org-keywords () "Lower case Org keywords and block identifiers. Example: \"#+TITLE\" -> \"#+title\" \"#+BEGIN_EXAMPLE\" -> \"#+begin_example\" Inspiration: https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 ." (interactive) (save-excursion (goto-char (point-min)) (let ((case-fold-search nil) (count 0)) ;; Match examples: "#+FOO bar", "#+FOO:", "=#+FOO=", "~#+FOO~", ;; ",#+FOO bar", "#+FOO_bar", "#+FOO". (while (re-search-forward "\\(?1:#\\+[A-Z_]+\\(?:_[[:alpha:]]+\\)*\\)\\(?:[ :=~]\\|$\\)" nil :noerror) (setq count (1+ count)) (replace-match (downcase (match-string-no-properties 1)) :fixedcase nil nil 1)) (message "Lower-cased %d matches" count)))) -- Kaushal Modi --94eb2c0660b43fc6d405643d9a99 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 25= , 2018 at 3:17 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> I also like the blocks and keywords to be lower-cased. I see this in t= he
> latest commit on master:
> https://co= de.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0=
>
> Did you do that lower-casing by hand? Or do you have an elisp snippet = or
> some script that does that?

IIRC, this was grep then eyeball and a macro to automatically convert
a line.

I got back to this task at hand= , and this elisp command works just fine (based on export testing of a bunc= h of Org files).

Let me know if I missed out on something= (or did over-lower-casing) :)

(defun modi/lower-case-org-keywords (= )
=C2=A0 "Lower case Org keywords and block identifiers.

Exa= mple: \"#+TITLE\" -> \"#+title\"
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \"#+BEGIN_EXAMPLE\" -> \&quo= t;#+begin_example\"

Inspiration:
http= s://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c12= 10daf0."
=C2=A0 (interactive)
=C2=A0 (save-excursion
=C2= =A0=C2=A0=C2=A0 (goto-char (point-min))
=C2=A0=C2=A0=C2=A0 (let ((case-f= old-search nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (= count 0))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; Match examples: "#+FOO = bar", "#+FOO:", "=3D#+FOO=3D", "~#+FOO~"= ,
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ",#+FOO b= ar", "#+FOO_bar<eol>", "#+FOO<eol>".=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (while (re-search-forward "\\(?1:#\\+= [A-Z_]+\\(?:_[[:alpha:]]+\\)*\\)\\(?:[ :=3D~]\\|$\\)" nil :noerror)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq count (1+ count))
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (replace-match (downcase (match-str= ing-no-properties 1)) :fixedcase nil nil 1))
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (message "Lower-cased %d matches" count))))
<= /div>--

Kaushal Modi

--94eb2c0660b43fc6d405643d9a99--