From: Oleh <ohwoeowho@gmail.com>
To: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: mark parent element?
Date: Fri, 14 Mar 2014 18:57:07 +0100 [thread overview]
Message-ID: <CAA01p3octbdHfjYyBoj+1c4+8H64QCodCNangFGhGTqGsSosSw@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec9jfG_i7mjuUHirvhfAJNuxateiQ2MrthC6t2QYcq5W8g@mail.gmail.com>
Hi Matt,
> I'm trying to write a function that will mark the parent of the
> current element. I think I understand how to do it but for some
> reason I can get the mark to persist after the funciton is called. I
> think it's really an elisp problem, not an org problem, but am hoping
> someone can ehelp me. Here's what I have:
>
> (defun er/mark-org-parent-element ()
> "Marks an org parent element"
> (interactive)
> (let ((parent (plist-get (car (cdr (org-element-at-point))) :parent)))
> (let ((parent-props (car (cdr parent))))
> ;; (print parent-props)
> ;; (print (plist-get parent-props :begin))
> ;; (print (plist-get parent-props :end))
> (if (plist-get parent-props :begin)
> (progn
> (goto-char (plist-get parent-props :begin))
> (set-mark (point))
> (goto-char (plist-get parent-props :end))
> (exchange-point-and-mark)
> )))
> )
> )
The probelm here is that `(org-element-at-point)` doesn't always have
a parent. I'm using plain outline functions for this purpose.
See `worf-mark-left' at https://github.com/abo-abo/worf/blob/master/worf.el.
regards,
Oleh
next prev parent reply other threads:[~2014-03-14 17:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 15:42 mark parent element? Matt Price
2014-03-14 17:11 ` Thorsten Jolitz
2014-03-14 17:57 ` Oleh [this message]
2014-03-14 18:11 ` Nicolas Goaziou
2014-03-15 2:06 ` Matt Price
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=CAA01p3octbdHfjYyBoj+1c4+8H64QCodCNangFGhGTqGsSosSw@mail.gmail.com \
--to=ohwoeowho@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=moptop99@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).