emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Christopher M. Miles" <numbchild@gmail.com>
To: Timothy <tecosaur@gmail.com>
Cc: emacs-orgmode@gnu.org, "Rudolf Adamkovič" <salutis@me.com>
Subject: Re: [BUG] Prefer lowercase #+results [9.5.2 (release_9.5.2-3-geb9f34 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]
Date: Thu, 13 Jan 2022 13:25:32 +0800	[thread overview]
Message-ID: <PAXPR08MB6640FA619619BB3205790B86A3539@PAXPR08MB6640.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <87r19cl08o.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2365 bytes --]


Timothy <tecosaur@gmail.com> writes:

> Hi Christopher,
>
>>> Is there a good reason for this?
>>>
>>> At a glance, I’d personally be tempted to make the use case insensitive, and
>>> only use `org-babel-results-keyword’ when inserting, or remove it all together.
>>
>> Me too, I hope it can be case-insensitive, if org-mode internal has already case-sensitive
>> processing. I suggest to keep one standard. I remember used to blocks like `#+BEGIN_SRC' etc are
>> uppercase by default. Latter changed into lowercase. Then I did a lot of work to replace them. If we
>> need to use lowercase, I suggest to use them all. It might improve regexp matching speed? Don’t know……
>
> See my reply to Ihor, I actually misread the code. It *is* case insensitive (as it
> should be). So, changing the default capitalisation of `org-babel-results-keyword'
> would have no effect on the interpretation or function of existing documents.
>
> Based on your comments on converting block case, maybe it would be worth
> providing a function to normalise the case in an Org document?
>
> All the best,
> Timothy

Indeed, there is a similar purpose function:

#+begin_src emacs-lisp
(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’", "“#+FOO”", ",#+FOO bar",
      ;;                 "#+FOO_bar<eol>", "#+FOO<eol>".
      (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))))
#+end_src

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-01-13  5:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08  8:58 [BUG] Prefer lowercase #+results [9.5.2 (release_9.5.2-3-geb9f34 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)] Rudolf Adamkovič
2022-01-08  9:47 ` Colin Baxter 😺
2022-01-08 18:18   ` Rudolf Adamkovič
2022-01-08 21:29 ` Tim Cross
2022-01-09 17:21   ` Rudolf Adamkovič
2022-01-10 10:26     ` Gyro Funch
2022-01-10 13:09       ` Timothy
2022-01-10 14:34         ` Kaushal Modi
2022-01-10 15:31         ` Colin Baxter 😺
2022-01-11  3:30           ` Ihor Radchenko
2022-01-11 14:57             ` Colin Baxter 😺
2022-01-11 15:15             ` Timothy
2022-01-11 19:13             ` Rudolf Adamkovič
2022-01-11 19:53               ` William Denton
2022-01-11 20:30               ` Colin Baxter 😺
2022-01-12 14:17               ` Ihor Radchenko
2022-01-12 16:00 ` Christopher M. Miles
2022-01-12 16:35   ` Timothy
2022-01-13  1:43     ` Ihor Radchenko
2022-01-13  4:27       ` Timothy
2022-01-13  3:29     ` Christopher M. Miles
2022-01-13  4:33       ` Timothy
2022-01-13  5:25         ` Christopher M. Miles [this message]
2022-01-14  2:00   ` Ihor Radchenko
2022-01-14  4:23     ` Christopher M. Miles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXPR08MB6640FA619619BB3205790B86A3539@PAXPR08MB6640.eurprd08.prod.outlook.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=salutis@me.com \
    --cc=tecosaur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).