[Top][All Lists]

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

Re: [O] Problem with choosing mode while editing blocks with C-c '

From: Nick Dokos
Subject: Re: [O] Problem with choosing mode while editing blocks with C-c '
Date: Tue, 13 Mar 2012 22:59:57 -0400

suvayu ali <address@hidden> wrote:

> Actually I keep confusing between the two and I'm not sure which I was
> seeing. I also forgot to mention I did not see the problem with a
> minimal setup. I got frustrated (I had to get the talk done), so I
> restarted Emacs and worked with LaTeX directly. Now in my new session I
> cannot replicate my issue. However it still breaks in a different way.
> Hitting C-c ' prompts me for a filename or a url.
> > For the OP (Suvayu): can you do C-h v org-edit-fixed-width-region-mode
> > RET and post the result? If the value is picture-mode, then I can
> > vaguely glimpse a (rather far-fetched) possible scenario that might get
> > you into the problem you describe, but I'd rather try to rule it out
> > first.
> >
> This variable is set to artist-mode.
> I did a binary search through my setup and found the problem occurs when
> case-fold-search is set to nil.
> You can replicate this with the following contents in an org file and
> (setq case-fold-search nil).
> ----8<-------------------8<----
> * Heading
> #+BEGIN_SRC latex
> %% this is a LaTeX comment
> #+begin_src latex
> %% this is a LaTeX comment
> #+end_src
> ----8<-------------------8<----
> C-c ' on the first block shold prompt you for a file or url and the
> second block should present a temporary buffer in latex mode.
> I have actually seen both these problem (the artist-mode and prompt for
> file or url) for quite a while from time to time. But I could never
> replicate them consistently. I guess today is my (somewhat) lucky
> day. :)

The case-fold-search problem is in
org-src.el:org-edit-src-code. case-fold-search is let-bound to t, but
the let form evaluates all the VARLIST forms before evaluating the body,
so the very next varlist

        (case-fold-search t)
        (info (org-edit-src-find-region-and-lang))

fails because in its evaluation, case-fold-search is still nil.

The solution is to use a let* form instead: just change the let on line
216 to a let*.

I think this will cure the other problem too: org-edit-special checks
for various things and if any of them succeed it skips the rest. The
behavior you get is the "everything else failed, let's call ffap".
But now since the org-edit-src-code call will (famous last words)
succeed, then it won't fall through.


reply via email to

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