emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "André A. Gomes" <andremegafone@gmail.com>
To: Timothy <tecosaur@gmail.com>
Cc: Bastien <bzg@gnu.org>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Rename headline to heading
Date: Fri, 15 Oct 2021 13:18:38 +0300	[thread overview]
Message-ID: <87fst28ubl.fsf@gmail.com> (raw)
In-Reply-To: <87v91yr4mn.fsf@gmail.com> (Timothy's message of "Fri, 15 Oct 2021 17:56:49 +0800")

Timothy <tecosaur@gmail.com> writes:

> I haven’t gone through the patches you’ve sent, but it looks like you’ve put a
> tremendous amount of effort into this! It’s fantastic to see. I think I can
> speak for the Org community when I say thank you.

I appreciate the kind words.  It's my pleasure to collaborate with the
community.  Let me stress the fact that it's my first contribution and
I'm not comfortable with the codebase, so I feedback is welcome :)

It actually took me less time than it may look like, since I used many
"tricks" like keyboard macros, registers, etc.  I even wrote some utils,
and it got me thinking about some Elisp tangential aspects.  For
instance, I realised it's hard to query-replace sexps' docstrings.
And no, I don't want to use multi-line regex (PCRE).  It's the wrong
tool IMO.  My "solution" is also poor, but for other reasons.  

--8<---------------cut here---------------start------------->8---
;; this is brittle.  for example, when there's a string as a value
;; before the actual docstring!
(defun query-replace-docstring-sexp (sexp-symbol from-string to-string)
  (save-excursion
    (do ((point (scan-lists (point-max) -1 0)
                (scan-lists (point) -1 0)))
        ((null point))
      (goto-char point)
      (save-excursion
        (let ((point-max-sexp (scan-sexps point 1)))
          (when (and (search-forward (concat "(" (symbol-name sexp-symbol))
                                     point-max-sexp t)
                     (search-forward "\"" point-max-sexp t))
            (query-replace from-string
                           to-string
                           t
                           (prog2 (backward-char) (point))
                           ;; the sexp here is the string enclosed by \"
                           (scan-sexps (point) 1))))))))
--8<---------------cut here---------------end--------------->8---


This is off-topic anyway.  My point is that there are ALWAYS interesting
things to do in any seemingly "boring" task.


--
André A. Gomes
"Free Thought, Free World"


      reply	other threads:[~2021-10-15 10:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 12:12 [PATCH] Rename headline to heading André A. Gomes
2021-08-05 15:04 ` Maxim Nikulin
2021-08-14 22:54   ` Tim Cross
2021-08-15 16:22     ` No Wayman
2021-08-15 16:50       ` No Wayman
2021-08-15 22:32     ` Jim Porter
2021-08-15 23:17       ` Tim Cross
2021-08-16  0:38         ` Jim Porter
2021-08-16  1:18           ` Tim Cross
2021-08-08 16:59 ` Tom Gillespie
2021-08-14 23:19 ` Tim Cross
2021-09-19 11:06 ` Timothy
2021-09-30 12:08   ` André A. Gomes
2021-09-26  9:27 ` Bastien
2021-09-30 12:21   ` André A. Gomes
2021-10-01  8:38     ` Bastien
2021-10-15  8:52       ` André A. Gomes
2021-10-15  9:56         ` Timothy
2021-10-15 10:18           ` André A. Gomes [this message]

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=87fst28ubl.fsf@gmail.com \
    --to=andremegafone@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --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).