emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] mark parent element?


From: Oleh
Subject: Re: [O] mark parent element?
Date: Fri, 14 Mar 2014 18:57:07 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]