From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: outline-minor-mode and code editing / export Date: Mon, 8 Jun 2009 08:54:56 +0200 Message-ID: <49673B8D-315B-4CE6-8BEB-67AB13B70649@gmail.com> References: <87skidxinh.fsf@stats.ox.ac.uk> <658100FA-212E-4D99-9297-5C73A53A0E70@gmail.com> <87oct0nerb.fsf@stats.ox.ac.uk> Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDZBY-0002xy-CJ for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 03:22:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDZBT-0002kv-4W for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 03:22:23 -0400 Received: from [199.232.76.173] (port=33214 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDZBT-0002kd-1e for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 03:22:19 -0400 Received: from mx20.gnu.org ([199.232.41.8]:48314) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MDZBS-0000mU-IJ for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 03:22:18 -0400 Received: from mail-ew0-f210.google.com ([209.85.219.210]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDZBR-0001HF-Oy for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 03:22:18 -0400 Received: by ewy6 with SMTP id 6so6018228ewy.42 for ; Mon, 08 Jun 2009 00:22:15 -0700 (PDT) In-Reply-To: <87oct0nerb.fsf@stats.ox.ac.uk> 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: Dan Davison Cc: emacs org-mode mailing list On Jun 7, 2009, at 7:19 PM, Dan Davison wrote: > Carsten Dominik writes: > >> Hi Dan, >> >> an alternative solution would be to turn off the major mode hook for >> org-edit-src. Would that be good or bad? It is probably never a >> good idea to have code folded in these snippet buffers? > > I think you're right that it's a personal customisation and it's not > really org's job to defend against it. I don't think the major mode > hook > should be disabled, as there'll be other things that users might > want to > configure, and retain in org-edit-src and htmlized versions. Do you > think it would be of sufficient general utility to add hooks to org to > cover this? (in which, e.g., outline-major-mode could be turned off?). > I.e. something like > > 1. org-edit-src-mode-hook * > 2. org-export-preprocess-src-buffer-hook > > Or maybe those should be the same hook? Yes, I would think so. The hooks is called `org-src-mode-hook'. > > Dan > > * Btw, a trivial thing, but I wonder if it would be appropriate to > rename > org-exit-edit-mode as something like org-edit-src-mode; it now has two > keybindings only one of which is to do with exiting. I don't understand this point. Please try again :-) - Carsten > > >> >> - Carsten >> >> On Jun 6, 2009, at 9:32 PM, Dan Davison wrote: >> >>> In turn on outline-minor-mode in the language major modes that I >>> use, so >>> that code starts up folded, via a call to org-content that is made >>> in my >>> major-mode hook. I'm finding that this has two undesirable >>> consequences >>> for org-mode, as follows. I have also described a possible solution, >>> as >>> implemented by the patch at the end. >>> >>> 1. The code appears folded on HTML export >>> >>> solution: add this line to org-export-format-source-code-or-example >>> (if (fboundp 'show-all) (show-all)) >>> >>> 2. org-edit-src-save does not remember the visibility state, so C-x >>> C-s >>> causes a jump to a different visibility state >>> >>> solution: save the value of org-cycle-global-status and, when the >>> edit buffer is re-entered, call one of {org-overview, >>> org-content,show-all} accordingly >>> >>> Dan >>> >>> p.s. Carsten: the first hunk in the second diff (org.el) refers to a >>> patch that I submitted a few days ago and which you said had been >>> applied. http://article.gmane.org/gmane.emacs.orgmode/14154 >>> However, I >>> believe it is not in the current git. Apologies if I have got (git) >>> confused, but if not I do believe there is still a need for it or an >>> equivalent solution: without this change I go to end of edit buffer, >>> hit >>> return a few times, and then C-x C-s fails (leaves me in org >>> buffer). >>> >>> >>> >>> >>> diff --git a/lisp/org-exp.el b/lisp/org-exp.el >>> index 0dcd956..5f0ad88 100644 >>> --- a/lisp/org-exp.el >>> +++ b/lisp/org-exp.el >>> @@ -2215,7 +2215,6 @@ INDENT was the original indentation of the >>> block." >>> (if (functionp mode) >>> (funcall mode) >>> (fundamental-mode)) >>> - (if (fboundp 'show-all) (show-all)) >>> (font-lock-fontify-buffer) >>> (set-buffer-modified-p nil) >>> (org-export-htmlize-region-for-paste >>> diff --git a/lisp/org.el b/lisp/org.el >>> index d124b1a..1eb5e74 100644 >>> --- a/lisp/org.el >>> +++ b/lisp/org.el >>> @@ -6875,9 +6875,7 @@ the language, a switch telling of the content >>> should be in a single line." >>> code) >>> (goto-char (point-min)) >>> (if (looking-at "[ \t\n]*\n") (replace-match "")) >>> - (when (re-search-forward "\n[ \t\n]*\\'" nil t) >>> - (replace-match "") >>> - (setq line (min line (org-current-line)))) >>> + (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")) >>> (when (org-bound-and-true-p org-edit-src-force-single-line) >>> (goto-char (point-min)) >>> (while (re-search-forward "\n" nil t) >>> @@ -6916,18 +6914,11 @@ the language, a switch telling of the >>> content should be in a single line." >>> (defun org-edit-src-save () >>> "Save parent buffer with current state source-code buffer." >>> (interactive) >>> - (let ((p (point)) (m (mark)) >>> - (visibility org-cycle-global-status) msg) >>> + (let ((p (point)) (m (mark)) msg) >>> (org-edit-src-exit) >>> (save-buffer) >>> (setq msg (current-message)) >>> (org-edit-src-code) >>> - (when visibility >>> - (setq org-cycle-global-status visibility) >>> - (cond >>> - ((equal org-cycle-global-status 'overview) (org-overview)) >>> - ((equal org-cycle-global-status 'contents) (org-content)) >>> - ((equal org-cycle-global-status 'all) (show-all)))) >>> (push-mark m 'nomessage) >>> (goto-char (min p (point-max))) >>> (message (or msg "")))) >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: 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 >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode