From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: parsing of emphasis versus links Date: Fri, 17 Mar 2017 15:32:27 -0400 Message-ID: References: <878to5dmvc.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coxc2-00024R-AL for emacs-orgmode@gnu.org; Fri, 17 Mar 2017 15:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coxby-0006Kx-Be for emacs-orgmode@gnu.org; Fri, 17 Mar 2017 15:32:34 -0400 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]:33038) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1coxby-0006KT-7S for emacs-orgmode@gnu.org; Fri, 17 Mar 2017 15:32:30 -0400 Received: by mail-qk0-x22c.google.com with SMTP id y76so72778935qkb.0 for ; Fri, 17 Mar 2017 12:32:29 -0700 (PDT) In-reply-to: <878to5dmvc.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Eric S Fraga Cc: emacs-orgmode@gnu.org I can not reproduce all the things you report. I think part of the problem is [calc:]. I have to have at least two characters of path to get a link that is colored. Eric S Fraga writes: > Hello, > > I have been playing with using embedded calc equations in org mode. I > have tried filters and with org emphasis markers but finally have come > around to using the new org link capabilities. Thank you John for > these! > > I've defined the following: > > #+begin_src emacs-lisp > (org-link-set-parameters > "calc" > :export (lambda (path desc backend) > (cond > ((eq 'latex backend) > (format "\\texttt{%s}" desc)))) > :face '(:foreground "chartreuse")) > #+end_src > > which I then use like this: > > #+begin_src org > [[calc:][Pv := 10^(6.886 - 1175.817 / (100 + 224.867)) => 1847.653]] > #+end_src > > and with appropriate settings for calc [1], calc can manipulate and > evaluate the expressions. So far, so good. > > Two minor issues: > > 1. the fontification doesn't colour the links in the colour I would like > (chartreuse, #7fff00). I get partial chartreuse, but there are some fontlock that can go on top, e.g. if it looks like a latex fragment. > > 2. if I have two expressions close enough, both with := and => > operators, org seems to get confused and interprets two of the = > symbols, each from one expression, as emphasis markers, as in this > example: > > #+begin_src org > [[calc:][y := 3 x - 5 => 55]] [[calc:][z := sqrt(y) => 7.416]] > #+end_src I can reproduce the issue above, but I have no way to help improve it. This particular case looks like emphasis from a simple regexp pov. Fixing it might require checking that the start/end are in the same org-element maybe. > > Screenshot attached showing both problems: colour and second = sign > disappearing in first link and first = sign in second link. > > Any suggestions on how to improve/fix these aspects? Both are minor > presentation issues and everything else is working very well. Calc > allows me to work with these expressions easily in org now! > > Many thanks, > eric > > > Footnotes: > [1] Settings using calc: links: > > #+begin_src emacs-lisp > (defun esf/org-mode-calc-settings () > (setq calc-embedded-open-formula "\\[\\[calc:]\\[" > calc-embedded-open-new-formula "[[calc:][" > calc-embedded-close-formula "]]" > calc-embedded-close-new-formula "]]")) > (add-hook 'org-mode-hook #'esf/org-mode-calc-settings) > #+end_src -- 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