emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Problem with choosing mode while editing blocks with C-c '
Date: Wed, 14 Mar 2012 10:03:48 +0100	[thread overview]
Message-ID: <20120314100348.284936b2@kuru.dyndns-at-home.com> (raw)
In-Reply-To: <CAMXnza3q8=gKjZHjcorL_FRdog3-O4SfF0UxiS_2VWD9dtzNDA@mail.gmail.com>

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

Sorry the quoting was all wrong! Gmail was behaving weirdly. I wanted to
quote the other message.

On Wed, Mar 14, 2012 at 03:59, Nick Dokos <nicholas.dokos@hp.com> wrote:
> 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*.


On Wed, Mar 14, 2012 at 09:41, suvayu ali <fatkasuvayu@gmail.com> wrote:
> Yup, your analysis was spot on. :) Changing the let to let* and
> reevaluating the defun fixed the issue.
>
> I hadn't grasped this subtlety about let*, dependencies on preceding
> bindings hidden behind function calls!

I am attaching the changes as a patch. Let me know if it is okay.

Thanks,

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: 0001-Change-let-bind-to-a-let-in-org-edit-src-code.patch --]
[-- Type: text/x-patch, Size: 2038 bytes --]

From 48eb85df419c38a57d35808ca3a3bc9d86e05c33 Mon Sep 17 00:00:00 2001
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Date: Wed, 14 Mar 2012 09:49:40 +0100
Subject: [PATCH] Change let bind to a let* in org-edit-src-code

	* org-src.el (org-edit-src-code): Change let bind to let*,
          e.g. if case-fold-search is bound to nil globally, the
          (case-fold-search t) doesn't work until we get to the body.

	  The fix and analysis was provided by Nick Dokos on this
          email message thread:
          <http://thread.gmane.org/gmane.emacs.orgmode/53335/focus=53342>

	  TINY CHANGE
---
 lisp/org-src.el |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9cd56d2..dfaa72d 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -213,16 +213,16 @@ (defun org-edit-src-code (&optional context code edit-buffer-name)
   (interactive)
   (unless (eq context 'save)
     (setq org-edit-src-saved-temp-window-config (current-window-configuration)))
-  (let ((mark (and (org-region-active-p) (mark)))
-	(case-fold-search t)
-	(info (org-edit-src-find-region-and-lang))
-	(full-info (org-babel-get-src-block-info 'light))
-	(org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive
-	(beg (make-marker))
-	(end (make-marker))
-	(allow-write-back-p (null code))
-	block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
-	begline markline markcol line col transmitted-variables)
+  (let* ((mark (and (org-region-active-p) (mark)))
+	 (case-fold-search t)
+	 (info (org-edit-src-find-region-and-lang))
+	 (full-info (org-babel-get-src-block-info 'light))
+	 (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive
+	 (beg (make-marker))
+	 (end (make-marker))
+	 (allow-write-back-p (null code))
+	 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
+	 begline markline markcol line col transmitted-variables)
     (if (not info)
 	nil
       (setq beg (move-marker beg (nth 0 info))
-- 
1.7.7.6


  reply	other threads:[~2012-03-14  9:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 22:02 Problem with choosing mode while editing blocks with C-c ' suvayu ali
2012-03-13 22:43 ` Nick Dokos
2012-03-13 23:04 ` Thorsten
2012-03-14  0:14   ` Nick Dokos
2012-03-14  7:07     ` Thorsten
     [not found]   ` <quintfall@googlemail.com>
2012-03-14  0:34     ` Nick Dokos
     [not found]       ` <fatkasuvayu@gmail.com>
2012-03-06  2:13         ` [BUG] LATEX_CLASS_OPTIONS not working suvayu ali
2012-03-06  2:42           ` Nick Dokos
2012-03-06 15:11             ` suvayu ali
2012-03-07 22:20               ` Nick Dokos
2012-03-08  0:43                 ` suvayu ali
2012-03-14  2:32       ` Problem with choosing mode while editing blocks with C-c ' suvayu ali
2012-03-14  2:59         ` Nick Dokos
2012-03-14  3:11         ` Nick Dokos
2012-03-14  8:41           ` suvayu ali
2012-03-14  9:03             ` Suvayu Ali [this message]
2012-03-14 13:50               ` Nick Dokos
2012-03-20  2:04               ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120314100348.284936b2@kuru.dyndns-at-home.com \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).