From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: outline-minor-mode and code editing / export Date: Sat, 06 Jun 2009 15:45:11 -0400 Message-ID: <87iqj9xi2g.fsf@stats.ox.ac.uk> References: <87skidxinh.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MD1pP-0002XT-BW for emacs-orgmode@gnu.org; Sat, 06 Jun 2009 15:45:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MD1pK-0002VV-HF for emacs-orgmode@gnu.org; Sat, 06 Jun 2009 15:45:19 -0400 Received: from [199.232.76.173] (port=54913 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MD1pK-0002VP-DS for emacs-orgmode@gnu.org; Sat, 06 Jun 2009 15:45:14 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:36287) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MD1pJ-00025H-RX for emacs-orgmode@gnu.org; Sat, 06 Jun 2009 15:45:14 -0400 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id n56JjDTB021582 for ; Sat, 6 Jun 2009 20:45:13 +0100 (BST) In-Reply-To: <87skidxinh.fsf@stats.ox.ac.uk> (Dan Davison's message of "Sat, 06 Jun 2009 15:32:34 -0400") 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: emacs org-mode mailing list Yes, well I definitely git confused in the sense that the patch I just sent was the inverse of what I intended (i.e. substitute - for + and vice versa in the original). The patch I meant to submit is diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 5f0ad88..0dcd956 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2215,6 +2215,7 @@ 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 1eb5e74..d124b1a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6875,7 +6875,9 @@ 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 "")) - (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")) + (when (re-search-forward "\n[ \t\n]*\\'" nil t) + (replace-match "") + (setq line (min line (org-current-line)))) (when (org-bound-and-true-p org-edit-src-force-single-line) (goto-char (point-min)) (while (re-search-forward "\n" nil t) @@ -6914,11 +6916,18 @@ 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)) msg) + (let ((p (point)) (m (mark)) + (visibility org-cycle-global-status) 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 "")))) Dan Davison writes: > 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