emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sacha Chua <sacha@sachachua.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-list-send-item: allow dest to be a buffer position
Date: Sat, 05 Feb 2022 21:44:29 -0500	[thread overview]
Message-ID: <87o83kaf3m.fsf@sachachua.com> (raw)

Passing an integer representing a buffer position to org-list-send-item
was failing because of the string-match-p, so here's something that lets
integers skip that part. I have copyright assignment papers on file.

Sacha

----------------------------------------------------------------
lisp/org-list.el: org-list-send-item: allow dest to be a buffer position

* lisp/org-list.el (org-list-send-item): Check if dest is a string
before matching it, to allow dest to be a buffer position.
---
 lisp/org-list.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index 3533c8319..f1ab2ca76 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -1442,7 +1442,7 @@ (defun org-list-send-item (item dest struct)
 		      (save-excursion
 			(goto-char (org-list-get-last-item item struct prevs))
 			(point-at-eol)))
-		     ((string-match-p "\\`[0-9]+\\'" dest)
+		     ((and (stringp dest) (string-match-p "\\`[0-9]+\\'" dest))
 		      (let* ((all (org-list-get-all-items item struct prevs))
 			     (len (length all))
 			     (index (mod (string-to-number dest) len)))
-- 
2.25.1




             reply	other threads:[~2022-02-06  2:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06  2:44 Sacha Chua [this message]
2022-02-06  9:57 ` [PATCH] org-list-send-item: allow dest to be a buffer position Ihor Radchenko
2022-02-07  0:48   ` Sacha Chua
2022-02-07 13:10     ` Ihor Radchenko

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=87o83kaf3m.fsf@sachachua.com \
    --to=sacha@sachachua.com \
    --cc=emacs-orgmode@gnu.org \
    /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).