emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* mark parent element?
@ 2014-03-14 15:42 Matt Price
  2014-03-14 17:11 ` Thorsten Jolitz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matt Price @ 2014-03-14 15:42 UTC (permalink / raw)
  To: Org Mode

Hi,

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)
            )))
    )
)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-15  2:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 15:42 mark parent element? Matt Price
2014-03-14 17:11 ` Thorsten Jolitz
2014-03-14 17:57 ` Oleh
2014-03-14 18:11 ` Nicolas Goaziou
2014-03-15  2:06   ` Matt Price

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).