From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Overlays and elisp code Date: Tue, 01 Feb 2011 11:01:17 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=43690 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkDzD-0003VF-FP for emacs-orgmode@gnu.org; Tue, 01 Feb 2011 06:01:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkDzC-0006cM-4t for emacs-orgmode@gnu.org; Tue, 01 Feb 2011 06:01:27 -0500 Received: from mail-wy0-f169.google.com ([74.125.82.169]:59100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkDzB-0006bx-U0 for emacs-orgmode@gnu.org; Tue, 01 Feb 2011 06:01:26 -0500 Received: by wyj26 with SMTP id 26so6993677wyj.0 for ; Tue, 01 Feb 2011 03:01:25 -0800 (PST) In-Reply-To: (Dan Davison's message of "Tue, 01 Feb 2011 10:51:23 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jeff Horn Cc: emacs-orgmode@gnu.org, Andrea Crotti >> On Mon, Jan 31, 2011 at 5:04 AM, Andrea Crotti >> wrote: >>> I found a strange behaviour which might be a bug, but maybe of my >>> configuration. [...] >>> - go over an elisp code block >>> - C-c ' to edit in the overlay >>> - C-c ' to go back when done >>> >>> And it works perfectly, BUT if for example I remove a parenthesis before >>> pressing C-c ', I can't go back. >>> >>> C-c ' becomes undefined and I have to kill both the overlay and the >>> original buffer. [...] > So it looks like paredit-mode refuses to start up (throws an error) if > the parentheses are unbalanced. So how about we use > > #+begin_src emacs-lisp > (add-hook 'emacs-lisp-mode-hook > (lambda () > (condition-case nil > (paredit-mode) > (error (message "Failed to activate paredit mode"))))) > #+end_src > > At the moment this message gets stamped on by a message which > org-edit-src always issues in the echo-area. When using C-c ', currently we can turn off the persistent message at the top of the screen by setting `org-edit-src-persistent-message' to nil, but we can't prevent the echo-area message without more code. The echo area message may be useful for new users, but for experienced users it is unnecessary and risks obscuring more useful messages. This patch provides control over both messages. The relevant customizable variable has a different name: `org-edit-src-messages'. Dan ~~~~~~~~~~~~~~~~~~~~~~~~ Change user option for controlling edit buffer messages * lisp/org-src.el (org-edit-src-messages): Change UI for controlling educational messages when src-code generating edit buffer. (org-edit-src-code): Implement control over persistent header message and echo-area message. #+begin_src diff diff --git a/lisp/org-src.el b/lisp/org-src.el index f55e292..ea9be6c 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -113,13 +113,16 @@ editing it with \\[org-edit-src-code]. Has no effect if "If non-nil, blank lines are removed when exiting the code edit buffer.") -(defcustom org-edit-src-persistent-message t - "Non-nil means show persistent exit help message while editing src examples. -The message is shown in the header-line, which will be created in the -first line of the window showing the editing buffer. -When nil, the message will only be shown intermittently in the echo area." +(defcustom org-edit-src-messages '(message header) + "Which messages to show when editing src examples. +If 'header is a member of this list, then a message is shown in +the header-line, which will be created in the first line of the +window showing the editing buffer. If 'message is in the list, +then a message will be displayed in the echo area." :group 'org-edit-structure - :type 'boolean) + :type '(set :greedy t + (const message) + (const header))) (defcustom org-src-window-setup 'reorganize-frame "How the source code edit buffer should be displayed. @@ -320,9 +323,10 @@ buffer." (org-set-local 'org-edit-src-block-indentation block-nindent) (org-src-mode) (set-buffer-modified-p nil) - (and org-edit-src-persistent-message + (and (memq 'header org-edit-src-messages) (org-set-local 'header-line-format msg))) - (unless quietp (message "%s" msg)) + (unless (or quietp (not (memq 'message org-edit-src-messages))) + (message "%s" msg)) t))) (defun org-edit-src-continue (e) #+end_src > I'm going to submit a patch > to control that in a subsequent email. > > Oh no. You got me editing elisp with paredit mode turned on. Maybe it > will last more than 5 minutes this time :) > > Dan > >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode