emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* returning propertized strings
@ 2017-05-20 22:59 John Kitchin
  2017-05-21  1:46 ` Charles C. Berry
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2017-05-20 22:59 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

If I run this block I get test as a result, but all its properties have
been stripped.

#+BEGIN_SRC emacs-lisp :results drawer
(propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
"tooltip")
#+END_SRC

#+RESULTS:
:RESULTS:
test
:END:

Does anyone know where this happens and if it can be avoided?

Thanks,
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 989 bytes --]

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

* Re: returning propertized strings
  2017-05-20 22:59 returning propertized strings John Kitchin
@ 2017-05-21  1:46 ` Charles C. Berry
  2017-05-21 13:04   ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2017-05-21  1:46 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org

On Sat, 20 May 2017, John Kitchin wrote:

> If I run this block I get test as a result, but all its properties have
> been stripped.
>
> #+BEGIN_SRC emacs-lisp :results drawer
> (propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
> "tooltip")
> #+END_SRC
>
> #+RESULTS:
> :RESULTS:
> test
> :END:
>
> Does anyone know where this happens and if it can be avoided?

Where?

Not sure, but late enough that `:results pp' will print them or `:post 
...' will receive them in `*this*'.

#+BEGIN_SRC emacs-lisp :results drawer pp
(propertize "test" 'font-lock-face '(:foreground "red") 'help-echo 
"tooltip")
#+END_SRC

#+RESULTS:
: #("test" 0 4
:   (help-echo "tooltip" font-lock-face
: 	     (:foreground "red")))

also `*this*' will contain the propertized version if you use the :post 
header arg.

HTH,

Chuck

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

* Re: returning propertized strings
  2017-05-21  1:46 ` Charles C. Berry
@ 2017-05-21 13:04   ` John Kitchin
  2017-05-21 21:21     ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2017-05-21 13:04 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]

On Sat, May 20, 2017 at 9:46 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:

> On Sat, 20 May 2017, John Kitchin wrote:
>
> If I run this block I get test as a result, but all its properties have
>> been stripped.
>>
>> #+BEGIN_SRC emacs-lisp :results drawer
>> (propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
>> "tooltip")
>> #+END_SRC
>>
>> #+RESULTS:
>> :RESULTS:
>> test
>> :END:
>>
>> Does anyone know where this happens and if it can be avoided?
>>
>
> Where?
>
> Not sure, but late enough that `:results pp' will print them or `:post
> ...' will receive them in `*this*'.
>
> #+BEGIN_SRC emacs-lisp :results drawer pp
> (propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
> "tooltip")
> #+END_SRC
>
> #+RESULTS:
> : #("test" 0 4
> :   (help-echo "tooltip" font-lock-face
> :            (:foreground "red")))
>

I get this too, but  I really want test to actually be red, and have a
tooltip in the results, and neither of these two methods seem to achieve
that.


>
> also `*this*' will contain the propertized version if you use the :post
> header arg.
>
> HTH,
>
> Chuck
>
>

[-- Attachment #2: Type: text/html, Size: 1962 bytes --]

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

* Re: returning propertized strings
  2017-05-21 13:04   ` John Kitchin
@ 2017-05-21 21:21     ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2017-05-21 21:21 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1925 bytes --]

I figured out the properties are getting lost in org-babel-format-result,
in the beginning with (setq result (org-no-properties result)).

I can see a reason this is desirable is that the properties would not be
persistent on saving/closing. On the other hand, it could be really useful
in some scenarios where temporary properties would be useful.

Are there other reasons having properties on strings in the output are not
desirable?

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Sun, May 21, 2017 at 9:04 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

>
>
> On Sat, May 20, 2017 at 9:46 PM, Charles C. Berry <ccberry@ucsd.edu>
> wrote:
>
>> On Sat, 20 May 2017, John Kitchin wrote:
>>
>> If I run this block I get test as a result, but all its properties have
>>> been stripped.
>>>
>>> #+BEGIN_SRC emacs-lisp :results drawer
>>> (propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
>>> "tooltip")
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> :RESULTS:
>>> test
>>> :END:
>>>
>>> Does anyone know where this happens and if it can be avoided?
>>>
>>
>> Where?
>>
>> Not sure, but late enough that `:results pp' will print them or `:post
>> ...' will receive them in `*this*'.
>>
>> #+BEGIN_SRC emacs-lisp :results drawer pp
>> (propertize "test" 'font-lock-face '(:foreground "red") 'help-echo
>> "tooltip")
>> #+END_SRC
>>
>> #+RESULTS:
>> : #("test" 0 4
>> :   (help-echo "tooltip" font-lock-face
>> :            (:foreground "red")))
>>
>
> I get this too, but  I really want test to actually be red, and have a
> tooltip in the results, and neither of these two methods seem to achieve
> that.
>
>
>>
>> also `*this*' will contain the propertized version if you use the :post
>> header arg.
>>
>> HTH,
>>
>> Chuck
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 3356 bytes --]

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

end of thread, other threads:[~2017-05-21 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-20 22:59 returning propertized strings John Kitchin
2017-05-21  1:46 ` Charles C. Berry
2017-05-21 13:04   ` John Kitchin
2017-05-21 21:21     ` John Kitchin

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