* [PATCH] Mode-specific fontification of babel source blocks @ 2010-08-03 23:12 David O'Toole 2010-08-03 23:14 ` David O'Toole ` (2 more replies) 0 siblings, 3 replies; 56+ messages in thread From: David O'Toole @ 2010-08-03 23:12 UTC (permalink / raw) To: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 289 bytes --] I've got a preliminary patch that adds optional "native" fontification for source blocks. It uses the block's declared mode to fontify the block text. So now blocks look the way they should, and this opens the way to further enhancements. Anyone up for an icons theme standard discussion? [-- Attachment #2: source-block-fontification.diff --] [-- Type: text/x-patch, Size: 2983 bytes --] diff --git a/lisp/org.el b/lisp/org.el index d2c1fdf..843e4fe 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5005,17 +5005,25 @@ will be prompted for." '(display t invisible t intangible t)) t))) +(defvar org-src-fontify-natively nil + "When non-nil, fontify source blocks like their major mode would.") + (defun org-fontify-meta-lines-and-blocks (limit) "Fontify #+ lines and blocks, in the correct ways." (let ((case-fold-search t)) (if (re-search-forward - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\) ?\\(\\(\\w\\|-\\)*\\)" limit t) - (let ((beg (match-beginning 0)) - (beg1 (line-beginning-position 2)) - (dc1 (downcase (match-string 2))) - (dc3 (downcase (match-string 3))) - end end1 quoting block-type) + (let* ((beg (match-beginning 0)) + (block-start (match-end 0)) + (block-end nil) + (language (downcase (if (stringp (match-string 6)) + (match-string 6) + "AAAAAAAAAA"))) + (beg1 (line-beginning-position 2)) + (dc1 (downcase (match-string 2))) + (dc3 (downcase (match-string 3))) + end end1 quoting block-type) (cond ((member dc1 '("html:" "ascii:" "latex:" "docbook:")) ;; a single line of backend-specific content @@ -5035,6 +5043,7 @@ will be prompted for." (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") nil t) ;; on purpose, we look further than LIMIT (setq end (match-end 0) end1 (1- (match-beginning 0))) + (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end '(display t invisible t intangible t))) @@ -5044,7 +5053,28 @@ will be prompted for." (add-text-properties beg beg1 '(face org-meta-line)) (add-text-properties end1 end '(face org-meta-line)) (cond - (quoting + (org-src-fontify-natively + (when (and (stringp language) (> (length language) 1)) + (let* ((mode-command (intern (concat (substring language 1) "-mode"))) + (string (buffer-substring-no-properties block-start block-end)) + (modified (buffer-modified-p)) + (fontified-output + (with-temp-buffer + (insert string) + (message language) + (funcall mode-command) + (font-lock-fontify-buffer) + (add-text-properties + (point-min) (point-max) + '(font-lock-fontified t fontified t font-lock-multiline t)) + (buffer-substring (point-min) (point-max))))) + (when fontified-output + (assert (stringp fontified-output)) + (goto-char block-start) + (delete-region block-start block-end) + (insert fontified-output) + (set-buffer-modified-p modified))))) + (quoting (add-text-properties beg1 end1 '(face org-block))) ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ 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 ^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-03 23:12 [PATCH] Mode-specific fontification of babel source blocks David O'Toole @ 2010-08-03 23:14 ` David O'Toole 2010-08-03 23:23 ` Erik Iverson 2010-08-04 2:55 ` Dan Davison 2010-08-15 6:33 ` [PATCH] Mode-specific fontification of babel source blocks Dan Davison 2 siblings, 1 reply; 56+ messages in thread From: David O'Toole @ 2010-08-03 23:14 UTC (permalink / raw) To: emacs-orgmode Mailinglist I've placed a screenshot of the fontification here: http://imagebin.ca/view/iRVK_as7.html On Tue, Aug 3, 2010 at 7:12 PM, David O'Toole <dto1138@gmail.com> wrote: > I've got a preliminary patch that adds optional "native" fontification > for source blocks. It uses the block's declared mode to fontify the > block text. So now blocks look the way they should, and this opens the > way to further enhancements. Anyone up for an icons theme standard > discussion? > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-03 23:14 ` David O'Toole @ 2010-08-03 23:23 ` Erik Iverson 0 siblings, 0 replies; 56+ messages in thread From: Erik Iverson @ 2010-08-03 23:23 UTC (permalink / raw) To: David O'Toole; +Cc: emacs-orgmode Mailinglist On 08/03/2010 06:14 PM, David O'Toole wrote: > I've placed a screenshot of the fontification here: > > http://imagebin.ca/view/iRVK_as7.html > Wow, great job. I once hacked something horrible together that involved several tricks to actually change the mode of the buffer when entering a source block (using indirect buffers) while keeping the indentation and syntax highlighting of the org content the same. Can't wait to try this out. victory.png, indeed! > On Tue, Aug 3, 2010 at 7:12 PM, David O'Toole<dto1138@gmail.com> wrote: >> I've got a preliminary patch that adds optional "native" fontification >> for source blocks. It uses the block's declared mode to fontify the >> block text. So now blocks look the way they should, and this opens the >> way to further enhancements. Anyone up for an icons theme standard >> discussion? >> > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-03 23:12 [PATCH] Mode-specific fontification of babel source blocks David O'Toole 2010-08-03 23:14 ` David O'Toole @ 2010-08-04 2:55 ` Dan Davison 2010-08-04 5:55 ` David O'Toole 2010-08-09 21:35 ` Dan Davison 2010-08-15 6:33 ` [PATCH] Mode-specific fontification of babel source blocks Dan Davison 2 siblings, 2 replies; 56+ messages in thread From: Dan Davison @ 2010-08-04 2:55 UTC (permalink / raw) To: David O'Toole; +Cc: emacs-orgmode Mailinglist "David O'Toole" <dto1138@gmail.com> writes: > I've got a preliminary patch that adds optional "native" fontification > for source blocks. It uses the block's declared mode to fontify the > block text. So now blocks look the way they should, and this opens the > way to further enhancements. Hi David, This is great! Here's a patch which allows the src blocks to have switches and header args, and also uses `org-src-lang-modes' to find the major mode. Do you want to host this somewhere while it evolves? I've put my commits in branch src-block-display of git://repo.or.cz/org-mode/babel.git for the moment. --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org.el b/lisp/org.el index 843e4fe..ad8b7f9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5012,14 +5012,13 @@ will be prompted for." "Fontify #+ lines and blocks, in the correct ways." (let ((case-fold-search t)) (if (re-search-forward - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\) ?\\(\\(\\w\\|-\\)*\\)" + ;; 1 2 3 3 4 5 5 4 2 6 6 7 7 1 + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)" limit t) (let* ((beg (match-beginning 0)) (block-start (match-end 0)) (block-end nil) - (language (downcase (if (stringp (match-string 6)) - (match-string 6) - "AAAAAAAAAA"))) + (language (match-string 6)) (beg1 (line-beginning-position 2)) (dc1 (downcase (match-string 2))) (dc3 (downcase (match-string 3))) @@ -5053,9 +5052,10 @@ will be prompted for." (add-text-properties beg beg1 '(face org-meta-line)) (add-text-properties end1 end '(face org-meta-line)) (cond - (org-src-fontify-natively - (when (and (stringp language) (> (length language) 1)) - (let* ((mode-command (intern (concat (substring language 1) "-mode"))) + ((and org-src-fontify-natively language) + (let* ((lang-mode + (or (cdr (assoc language org-src-lang-modes)) (intern language))) + (mode-command (intern (concat (symbol-name lang-mode) "-mode"))) (string (buffer-substring-no-properties block-start block-end)) (modified (buffer-modified-p)) (fontified-output @@ -5073,7 +5073,7 @@ will be prompted for." (goto-char block-start) (delete-region block-start block-end) (insert fontified-output) - (set-buffer-modified-p modified))))) + (set-buffer-modified-p modified)))) (quoting (add-text-properties beg1 end1 '(face org-block))) ((not org-fontify-quote-and-verse-blocks)) --8<---------------cut here---------------end--------------->8--- > Anyone up for an icons theme standard > discussion? Yes. 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 ^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-04 2:55 ` Dan Davison @ 2010-08-04 5:55 ` David O'Toole 2010-08-09 21:35 ` Dan Davison 1 sibling, 0 replies; 56+ messages in thread From: David O'Toole @ 2010-08-04 5:55 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist Hi, I don't have much more to do on the patch. I suspect it could be slow with larger files, perhaps it could be programmed to only refontify changed blocks (i.e. use the caching mechanism for block results to prevent redundant fontifying. Perhaps someone who knows about babel internals can help? On Tue, Aug 3, 2010 at 10:55 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: > "David O'Toole" <dto1138@gmail.com> writes: > >> I've got a preliminary patch that adds optional "native" fontification >> for source blocks. It uses the block's declared mode to fontify the >> block text. So now blocks look the way they should, and this opens the >> way to further enhancements. > > Hi David, > > This is great! Here's a patch which allows the src blocks to have > switches and header args, and also uses `org-src-lang-modes' to find the > major mode. Do you want to host this somewhere while it evolves? I've > put my commits in branch src-block-display of > git://repo.or.cz/org-mode/babel.git for the moment. > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/org.el b/lisp/org.el > index 843e4fe..ad8b7f9 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -5012,14 +5012,13 @@ will be prompted for." > "Fontify #+ lines and blocks, in the correct ways." > (let ((case-fold-search t)) > (if (re-search-forward > - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\) ?\\(\\(\\w\\|-\\)*\\)" > + ;; 1 2 3 3 4 5 5 4 2 6 6 7 7 1 > + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)" > limit t) > (let* ((beg (match-beginning 0)) > (block-start (match-end 0)) > (block-end nil) > - (language (downcase (if (stringp (match-string 6)) > - (match-string 6) > - "AAAAAAAAAA"))) > + (language (match-string 6)) > (beg1 (line-beginning-position 2)) > (dc1 (downcase (match-string 2))) > (dc3 (downcase (match-string 3))) > @@ -5053,9 +5052,10 @@ will be prompted for." > (add-text-properties beg beg1 '(face org-meta-line)) > (add-text-properties end1 end '(face org-meta-line)) > (cond > - (org-src-fontify-natively > - (when (and (stringp language) (> (length language) 1)) > - (let* ((mode-command (intern (concat (substring language 1) "-mode"))) > + ((and org-src-fontify-natively language) > + (let* ((lang-mode > + (or (cdr (assoc language org-src-lang-modes)) (intern language))) > + (mode-command (intern (concat (symbol-name lang-mode) "-mode"))) > (string (buffer-substring-no-properties block-start block-end)) > (modified (buffer-modified-p)) > (fontified-output > @@ -5073,7 +5073,7 @@ will be prompted for." > (goto-char block-start) > (delete-region block-start block-end) > (insert fontified-output) > - (set-buffer-modified-p modified))))) > + (set-buffer-modified-p modified)))) > (quoting > (add-text-properties beg1 end1 '(face org-block))) > ((not org-fontify-quote-and-verse-blocks)) > --8<---------------cut here---------------end--------------->8--- > > >> Anyone up for an icons theme standard >> discussion? > > Yes. > > 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-04 2:55 ` Dan Davison 2010-08-04 5:55 ` David O'Toole @ 2010-08-09 21:35 ` Dan Davison 2010-09-02 15:51 ` Org now fontifies code blocks Dan Davison 1 sibling, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-08-09 21:35 UTC (permalink / raw) To: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 770 bytes --] Dan Davison <davison@stats.ox.ac.uk> writes: > "David O'Toole" <dto1138@gmail.com> writes: > >> I've got a preliminary patch that adds optional "native" fontification >> for source blocks. It uses the block's declared mode to fontify the >> block text. So now blocks look the way they should, and this opens the >> way to further enhancements. > > Hi David, > > This is great! Here's a patch which allows the src blocks to have > switches and header args, and also uses `org-src-lang-modes' to find the > major mode. I'm resending this as a match against the current master branch, and as an attachment so that it goes into the patchwork system. I am keeping this line of patches in branch `src-block-fontification' at git://github.com/dandavison/org-devel.git Dan [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: src-block-fontification.diff --] [-- Type: text/x-diff, Size: 2985 bytes --] diff --git a/lisp/org.el b/lisp/org.el index af4f793..ef6e769 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5017,17 +5017,24 @@ will be prompted for." '(display t invisible t intangible t)) t))) +(defvar org-src-fontify-natively nil + "When non-nil, fontify source blocks like their major mode would.") + (defun org-fontify-meta-lines-and-blocks (limit) "Fontify #+ lines and blocks, in the correct ways." (let ((case-fold-search t)) (if (re-search-forward - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" + ;; 1 2 3 3 4 5 5 4 2 6 6 7 7 1 + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)" limit t) - (let ((beg (match-beginning 0)) - (beg1 (line-beginning-position 2)) - (dc1 (downcase (match-string 2))) - (dc3 (downcase (match-string 3))) - end end1 quoting block-type) + (let* ((beg (match-beginning 0)) + (block-start (match-end 0)) + (block-end nil) + (language (match-string 6)) + (beg1 (line-beginning-position 2)) + (dc1 (downcase (match-string 2))) + (dc3 (downcase (match-string 3))) + end end1 quoting block-type) (cond ((member dc1 '("html:" "ascii:" "latex:" "docbook:")) ;; a single line of backend-specific content @@ -5047,6 +5054,7 @@ will be prompted for." (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") nil t) ;; on purpose, we look further than LIMIT (setq end (match-end 0) end1 (1- (match-beginning 0))) + (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end '(display t invisible t intangible t))) @@ -5056,6 +5064,28 @@ will be prompted for." (add-text-properties beg beg1 '(face org-meta-line)) (add-text-properties end1 end '(face org-meta-line)) (cond + ((and org-src-fontify-natively language) + (let* ((lang-mode + (or (cdr (assoc language org-src-lang-modes)) (intern language))) + (mode-command (intern (concat (symbol-name lang-mode) "-mode"))) + (string (buffer-substring-no-properties block-start block-end)) + (modified (buffer-modified-p)) + (fontified-output + (with-temp-buffer + (insert string) + (message language) + (funcall mode-command) + (font-lock-fontify-buffer) + (add-text-properties + (point-min) (point-max) + '(font-lock-fontified t fontified t font-lock-multiline t)) + (buffer-substring (point-min) (point-max))))) + (when fontified-output + (assert (stringp fontified-output)) + (goto-char block-start) + (delete-region block-start block-end) + (insert fontified-output) + (set-buffer-modified-p modified)))) (quoting (add-text-properties beg1 end1 '(face org-block))) ((not org-fontify-quote-and-verse-blocks)) [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ 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 ^ permalink raw reply related [flat|nested] 56+ messages in thread
* Org now fontifies code blocks 2010-08-09 21:35 ` Dan Davison @ 2010-09-02 15:51 ` Dan Davison 2010-09-02 17:04 ` Erik Iverson ` (2 more replies) 0 siblings, 3 replies; 56+ messages in thread From: Dan Davison @ 2010-09-02 15:51 UTC (permalink / raw) To: emacs-orgmode Mailinglist I've just pushed changes which mean that Org now fontifies code in code blocks. Currently, this is turned on by default, so it would be helpful if people could report any problems, and opinions as to whether it should be on or off by default. To turn it off, use (setq org-src-fontify-natively nil) With it off, there are two functions for manually fontifying code blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. With it on, on my netbook, there is a slight delay when typing in code blocks of over 100 lines in length, and this is pronounced in code blocks of several hundred lines. Just to be clear, this is fontification only -- no other language major mode features -- so the default method of editing code is still C-c ' (org-edit-src-code). Thanks to David O'Toole for the original patch. The final version of the patch is based on Carsten's suggestions for a more efficient implementation. Dan Dan Davison <davison@stats.ox.ac.uk> writes: > Dan Davison <davison@stats.ox.ac.uk> writes: > >> "David O'Toole" <dto1138@gmail.com> writes: >> >>> I've got a preliminary patch that adds optional "native" fontification >>> for source blocks. It uses the block's declared mode to fontify the >>> block text. So now blocks look the way they should, and this opens the >>> way to further enhancements. >> >> Hi David, >> >> This is great! Here's a patch which allows the src blocks to have >> switches and header args, and also uses `org-src-lang-modes' to find the >> major mode. > > I'm resending this as a match against the current master branch, and as > an attachment so that it goes into the patchwork system. I am keeping > this line of patches in branch `src-block-fontification' at > git://github.com/dandavison/org-devel.git > > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-02 15:51 ` Org now fontifies code blocks Dan Davison @ 2010-09-02 17:04 ` Erik Iverson 2010-09-02 19:06 ` Native TAB in code blocks [WAS Re: Org now fontifies code blocks] Dan Davison 2010-09-02 20:26 ` Org now fontifies " Sébastien Vauban 2010-09-03 17:30 ` Eric S Fraga 2 siblings, 1 reply; 56+ messages in thread From: Erik Iverson @ 2010-09-02 17:04 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist Dan, Thank you to David and yourself for this great feature. I have absolutely no opinion about the default on/off, except to say it looks great on. Is your TAB key patch[1] in master yet? http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28640.html Dan Davison wrote: > I've just pushed changes which mean that Org now fontifies code in code > blocks. Currently, this is turned on by default, so it would be helpful > if people could report any problems, and opinions as to whether it > should be on or off by default. > > To turn it off, use > > (setq org-src-fontify-natively nil) > > With it off, there are two functions for manually fontifying code > blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. > > With it on, on my netbook, there is a slight delay when typing in code > blocks of over 100 lines in length, and this is pronounced in code > blocks of several hundred lines. > > Just to be clear, this is fontification only -- no other language major > mode features -- so the default method of editing code is still C-c ' > (org-edit-src-code). > > Thanks to David O'Toole for the original patch. The final version of the > patch is based on Carsten's suggestions for a more efficient > implementation. > > Dan > > > Dan Davison <davison@stats.ox.ac.uk> writes: > >> Dan Davison <davison@stats.ox.ac.uk> writes: >> >>> "David O'Toole" <dto1138@gmail.com> writes: >>> >>>> I've got a preliminary patch that adds optional "native" fontification >>>> for source blocks. It uses the block's declared mode to fontify the >>>> block text. So now blocks look the way they should, and this opens the >>>> way to further enhancements. >>> Hi David, >>> >>> This is great! Here's a patch which allows the src blocks to have >>> switches and header args, and also uses `org-src-lang-modes' to find the >>> major mode. >> I'm resending this as a match against the current master branch, and as >> an attachment so that it goes into the patchwork system. I am keeping >> this line of patches in branch `src-block-fontification' at >> git://github.com/dandavison/org-devel.git >> >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Native TAB in code blocks [WAS Re: Org now fontifies code blocks] 2010-09-02 17:04 ` Erik Iverson @ 2010-09-02 19:06 ` Dan Davison 2010-09-02 19:18 ` Carsten Dominik 0 siblings, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-02 19:06 UTC (permalink / raw) To: Erik Iverson; +Cc: emacs-orgmode Mailinglist, Carsten Dominik Erik Iverson <eriki@ccbr.umn.edu> writes: > Dan, > > Thank you to David and yourself for this great feature. I have > absolutely no opinion about the default on/off, except to say it > looks great on. > > Is your TAB key patch[1] in master yet? > http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28640.html Hi Erik, Since these[1] changes, language-native TAB can be achieved in code blocks via C-c C-v C-x TAB and C-c C-v x TAB. We can add this to org-tab-first-hook, controlled by a variable `org-src-tab-acts-natively' as below. Carsten -- would you like to add this to Org, or leave it as a user customisation? Dan --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-src.el b/lisp/org-src.el index 6c09cbd..d1948cc 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -715,6 +715,19 @@ Org-babel commands." (call-interactively (lookup-key org-babel-map key))))) +(defvar org-src-tab-acts-natively nil + "If non-nil, the effect of TAB in a code block is as if it were +issued in the language major mode buffer.") + +(defun org-src-native-tab-command-maybe () + "Perform language-specific TAB action. +Alter code block according to effect of TAB in the language major +mode." + (and org-src-tab-acts-natively + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) + +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) + (defun org-src-font-lock-fontify-block (lang start end) "Fontify code block. This function is called by emacs automatic fontification, as long --8<---------------cut here---------------end--------------->8--- Footnotes: [1] http://thread.gmane.org/gmane.emacs.orgmode/28950 > > > > Dan Davison wrote: >> I've just pushed changes which mean that Org now fontifies code in code >> blocks. Currently, this is turned on by default, so it would be helpful >> if people could report any problems, and opinions as to whether it >> should be on or off by default. >> >> To turn it off, use >> >> (setq org-src-fontify-natively nil) >> >> With it off, there are two functions for manually fontifying code >> blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. >> >> With it on, on my netbook, there is a slight delay when typing in code >> blocks of over 100 lines in length, and this is pronounced in code >> blocks of several hundred lines. >> >> Just to be clear, this is fontification only -- no other language major >> mode features -- so the default method of editing code is still C-c ' >> (org-edit-src-code). >> >> Thanks to David O'Toole for the original patch. The final version of the >> patch is based on Carsten's suggestions for a more efficient >> implementation. >> >> Dan >> >> >> Dan Davison <davison@stats.ox.ac.uk> writes: >> >>> Dan Davison <davison@stats.ox.ac.uk> writes: >>> >>>> "David O'Toole" <dto1138@gmail.com> writes: >>>> >>>>> I've got a preliminary patch that adds optional "native" fontification >>>>> for source blocks. It uses the block's declared mode to fontify the >>>>> block text. So now blocks look the way they should, and this opens the >>>>> way to further enhancements. >>>> Hi David, >>>> >>>> This is great! Here's a patch which allows the src blocks to have >>>> switches and header args, and also uses `org-src-lang-modes' to find the >>>> major mode. >>> I'm resending this as a match against the current master branch, and as >>> an attachment so that it goes into the patchwork system. I am keeping >>> this line of patches in branch `src-block-fontification' at >>> git://github.com/dandavison/org-devel.git >>> >>> 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 > > _______________________________________________ > 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 ^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: Native TAB in code blocks [WAS Re: Org now fontifies code blocks] 2010-09-02 19:06 ` Native TAB in code blocks [WAS Re: Org now fontifies code blocks] Dan Davison @ 2010-09-02 19:18 ` Carsten Dominik 2010-09-02 20:36 ` Native TAB in code blocks Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Carsten Dominik @ 2010-09-02 19:18 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist On Thu, Sep 2, 2010 at 9:06 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: > Erik Iverson <eriki@ccbr.umn.edu> writes: > >> Dan, >> >> Thank you to David and yourself for this great feature. I have >> absolutely no opinion about the default on/off, except to say it >> looks great on. >> >> Is your TAB key patch[1] in master yet? >> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28640.html > > Hi Erik, > > Since these[1] changes, language-native TAB can be achieved in code > blocks via C-c C-v C-x TAB and C-c C-v x TAB. We can add this to > org-tab-first-hook, controlled by a variable `org-src-tab-acts-natively' > as below. Carsten -- would you like to add this to Org, or leave it as a > user customisation? I think we can add this to Org. Maybe default off, for now? - Carten > > Dan > > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/org-src.el b/lisp/org-src.el > index 6c09cbd..d1948cc 100644 > --- a/lisp/org-src.el > +++ b/lisp/org-src.el > @@ -715,6 +715,19 @@ Org-babel commands." > (call-interactively > (lookup-key org-babel-map key))))) > > +(defvar org-src-tab-acts-natively nil > + "If non-nil, the effect of TAB in a code block is as if it were > +issued in the language major mode buffer.") > + > +(defun org-src-native-tab-command-maybe () > + "Perform language-specific TAB action. > +Alter code block according to effect of TAB in the language major > +mode." > + (and org-src-tab-acts-natively > + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) > + > +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) > + > (defun org-src-font-lock-fontify-block (lang start end) > "Fontify code block. > This function is called by emacs automatic fontification, as long > --8<---------------cut here---------------end--------------->8--- > > > Footnotes: > > [1] http://thread.gmane.org/gmane.emacs.orgmode/28950 > >> >> >> >> Dan Davison wrote: >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >>> >>> To turn it off, use >>> >>> (setq org-src-fontify-natively nil) >>> >>> With it off, there are two functions for manually fontifying code >>> blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. >>> >>> With it on, on my netbook, there is a slight delay when typing in code >>> blocks of over 100 lines in length, and this is pronounced in code >>> blocks of several hundred lines. >>> >>> Just to be clear, this is fontification only -- no other language major >>> mode features -- so the default method of editing code is still C-c ' >>> (org-edit-src-code). >>> >>> Thanks to David O'Toole for the original patch. The final version of the >>> patch is based on Carsten's suggestions for a more efficient >>> implementation. >>> >>> Dan >>> >>> >>> Dan Davison <davison@stats.ox.ac.uk> writes: >>> >>>> Dan Davison <davison@stats.ox.ac.uk> writes: >>>> >>>>> "David O'Toole" <dto1138@gmail.com> writes: >>>>> >>>>>> I've got a preliminary patch that adds optional "native" fontification >>>>>> for source blocks. It uses the block's declared mode to fontify the >>>>>> block text. So now blocks look the way they should, and this opens the >>>>>> way to further enhancements. >>>>> Hi David, >>>>> >>>>> This is great! Here's a patch which allows the src blocks to have >>>>> switches and header args, and also uses `org-src-lang-modes' to find the >>>>> major mode. >>>> I'm resending this as a match against the current master branch, and as >>>> an attachment so that it goes into the patchwork system. I am keeping >>>> this line of patches in branch `src-block-fontification' at >>>> git://github.com/dandavison/org-devel.git >>>> >>>> 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 >> >> _______________________________________________ >> 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 > > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Native TAB in code blocks 2010-09-02 19:18 ` Carsten Dominik @ 2010-09-02 20:36 ` Dan Davison 2010-09-03 8:11 ` Julien Fantin 0 siblings, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-02 20:36 UTC (permalink / raw) To: Carsten Dominik; +Cc: emacs-orgmode Mailinglist Carsten Dominik <carsten.dominik@gmail.com> writes: > On Thu, Sep 2, 2010 at 9:06 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: >> Erik Iverson <eriki@ccbr.umn.edu> writes: >> >>> Dan, >>> >>> Thank you to David and yourself for this great feature. I have >>> absolutely no opinion about the default on/off, except to say it >>> looks great on. >>> >>> Is your TAB key patch[1] in master yet? >>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28640.html >> >> Hi Erik, >> >> Since these[1] changes, language-native TAB can be achieved in code >> blocks via C-c C-v C-x TAB and C-c C-v x TAB. We can add this to >> org-tab-first-hook, controlled by a variable `org-src-tab-acts-natively' >> as below. Carsten -- would you like to add this to Org, or leave it as a >> user customisation? > > I think we can add this to Org. Maybe default off, for now? OK, done. So (setq org-src-tab-acts-natively t) to turn it on. Dan > > - Carten > >> >> Dan >> >> >> --8<---------------cut here---------------start------------->8--- >> diff --git a/lisp/org-src.el b/lisp/org-src.el >> index 6c09cbd..d1948cc 100644 >> --- a/lisp/org-src.el >> +++ b/lisp/org-src.el >> @@ -715,6 +715,19 @@ Org-babel commands." >> (call-interactively >> (lookup-key org-babel-map key))))) >> >> +(defvar org-src-tab-acts-natively nil >> + "If non-nil, the effect of TAB in a code block is as if it were >> +issued in the language major mode buffer.") >> + >> +(defun org-src-native-tab-command-maybe () >> + "Perform language-specific TAB action. >> +Alter code block according to effect of TAB in the language major >> +mode." >> + (and org-src-tab-acts-natively >> + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) >> + >> +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) >> + >> (defun org-src-font-lock-fontify-block (lang start end) >> "Fontify code block. >> This function is called by emacs automatic fontification, as long >> --8<---------------cut here---------------end--------------->8--- >> >> >> Footnotes: >> >> [1] http://thread.gmane.org/gmane.emacs.orgmode/28950 >> >>> >>> >>> >>> Dan Davison wrote: >>>> I've just pushed changes which mean that Org now fontifies code in code >>>> blocks. Currently, this is turned on by default, so it would be helpful >>>> if people could report any problems, and opinions as to whether it >>>> should be on or off by default. >>>> >>>> To turn it off, use >>>> >>>> (setq org-src-fontify-natively nil) >>>> >>>> With it off, there are two functions for manually fontifying code >>>> blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. >>>> >>>> With it on, on my netbook, there is a slight delay when typing in code >>>> blocks of over 100 lines in length, and this is pronounced in code >>>> blocks of several hundred lines. >>>> >>>> Just to be clear, this is fontification only -- no other language major >>>> mode features -- so the default method of editing code is still C-c ' >>>> (org-edit-src-code). >>>> >>>> Thanks to David O'Toole for the original patch. The final version of the >>>> patch is based on Carsten's suggestions for a more efficient >>>> implementation. >>>> >>>> Dan >>>> >>>> >>>> Dan Davison <davison@stats.ox.ac.uk> writes: >>>> >>>>> Dan Davison <davison@stats.ox.ac.uk> writes: >>>>> >>>>>> "David O'Toole" <dto1138@gmail.com> writes: >>>>>> >>>>>>> I've got a preliminary patch that adds optional "native" fontification >>>>>>> for source blocks. It uses the block's declared mode to fontify the >>>>>>> block text. So now blocks look the way they should, and this opens the >>>>>>> way to further enhancements. >>>>>> Hi David, >>>>>> >>>>>> This is great! Here's a patch which allows the src blocks to have >>>>>> switches and header args, and also uses `org-src-lang-modes' to find the >>>>>> major mode. >>>>> I'm resending this as a match against the current master branch, and as >>>>> an attachment so that it goes into the patchwork system. I am keeping >>>>> this line of patches in branch `src-block-fontification' at >>>>> git://github.com/dandavison/org-devel.git >>>>> >>>>> 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 >>> >>> _______________________________________________ >>> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Native TAB in code blocks 2010-09-02 20:36 ` Native TAB in code blocks Dan Davison @ 2010-09-03 8:11 ` Julien Fantin 0 siblings, 0 replies; 56+ messages in thread From: Julien Fantin @ 2010-09-03 8:11 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist, Carsten Dominik Another great addition Dan, thanks ! Cheers On Thu, Sep 2, 2010 at 10:36 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: > Carsten Dominik <carsten.dominik@gmail.com> writes: > >> On Thu, Sep 2, 2010 at 9:06 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: >>> Erik Iverson <eriki@ccbr.umn.edu> writes: >>> >>>> Dan, >>>> >>>> Thank you to David and yourself for this great feature. I have >>>> absolutely no opinion about the default on/off, except to say it >>>> looks great on. >>>> >>>> Is your TAB key patch[1] in master yet? >>>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28640.html >>> >>> Hi Erik, >>> >>> Since these[1] changes, language-native TAB can be achieved in code >>> blocks via C-c C-v C-x TAB and C-c C-v x TAB. We can add this to >>> org-tab-first-hook, controlled by a variable `org-src-tab-acts-natively' >>> as below. Carsten -- would you like to add this to Org, or leave it as a >>> user customisation? >> >> I think we can add this to Org. Maybe default off, for now? > > OK, done. So > > (setq org-src-tab-acts-natively t) > > to turn it on. > > Dan > >> >> - Carten >> >>> >>> Dan >>> >>> >>> --8<---------------cut here---------------start------------->8--- >>> diff --git a/lisp/org-src.el b/lisp/org-src.el >>> index 6c09cbd..d1948cc 100644 >>> --- a/lisp/org-src.el >>> +++ b/lisp/org-src.el >>> @@ -715,6 +715,19 @@ Org-babel commands." >>> (call-interactively >>> (lookup-key org-babel-map key))))) >>> >>> +(defvar org-src-tab-acts-natively nil >>> + "If non-nil, the effect of TAB in a code block is as if it were >>> +issued in the language major mode buffer.") >>> + >>> +(defun org-src-native-tab-command-maybe () >>> + "Perform language-specific TAB action. >>> +Alter code block according to effect of TAB in the language major >>> +mode." >>> + (and org-src-tab-acts-natively >>> + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) >>> + >>> +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) >>> + >>> (defun org-src-font-lock-fontify-block (lang start end) >>> "Fontify code block. >>> This function is called by emacs automatic fontification, as long >>> --8<---------------cut here---------------end--------------->8--- >>> >>> >>> Footnotes: >>> >>> [1] http://thread.gmane.org/gmane.emacs.orgmode/28950 >>> >>>> >>>> >>>> >>>> Dan Davison wrote: >>>>> I've just pushed changes which mean that Org now fontifies code in code >>>>> blocks. Currently, this is turned on by default, so it would be helpful >>>>> if people could report any problems, and opinions as to whether it >>>>> should be on or off by default. >>>>> >>>>> To turn it off, use >>>>> >>>>> (setq org-src-fontify-natively nil) >>>>> >>>>> With it off, there are two functions for manually fontifying code >>>>> blocks: `org-src-fontify-block' and `org-src-fontify-buffer'. >>>>> >>>>> With it on, on my netbook, there is a slight delay when typing in code >>>>> blocks of over 100 lines in length, and this is pronounced in code >>>>> blocks of several hundred lines. >>>>> >>>>> Just to be clear, this is fontification only -- no other language major >>>>> mode features -- so the default method of editing code is still C-c ' >>>>> (org-edit-src-code). >>>>> >>>>> Thanks to David O'Toole for the original patch. The final version of the >>>>> patch is based on Carsten's suggestions for a more efficient >>>>> implementation. >>>>> >>>>> Dan >>>>> >>>>> >>>>> Dan Davison <davison@stats.ox.ac.uk> writes: >>>>> >>>>>> Dan Davison <davison@stats.ox.ac.uk> writes: >>>>>> >>>>>>> "David O'Toole" <dto1138@gmail.com> writes: >>>>>>> >>>>>>>> I've got a preliminary patch that adds optional "native" fontification >>>>>>>> for source blocks. It uses the block's declared mode to fontify the >>>>>>>> block text. So now blocks look the way they should, and this opens the >>>>>>>> way to further enhancements. >>>>>>> Hi David, >>>>>>> >>>>>>> This is great! Here's a patch which allows the src blocks to have >>>>>>> switches and header args, and also uses `org-src-lang-modes' to find the >>>>>>> major mode. >>>>>> I'm resending this as a match against the current master branch, and as >>>>>> an attachment so that it goes into the patchwork system. I am keeping >>>>>> this line of patches in branch `src-block-fontification' at >>>>>> git://github.com/dandavison/org-devel.git >>>>>> >>>>>> 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 >>>> >>>> _______________________________________________ >>>> 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 > > _______________________________________________ > 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-02 15:51 ` Org now fontifies code blocks Dan Davison 2010-09-02 17:04 ` Erik Iverson @ 2010-09-02 20:26 ` Sébastien Vauban 2010-09-03 17:30 ` Eric S Fraga 2 siblings, 0 replies; 56+ messages in thread From: Sébastien Vauban @ 2010-09-02 20:26 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Dan (and David), Dan Davison wrote: > I've just pushed changes which mean that Org now fontifies code in code > blocks. Currently, this is turned on by default, so it would be helpful if > people could report any problems, and opinions Three remarks: 1. That simply *is* great! Thanks a lot, David, for your initial code... 2. It "breaks" my first (and only, up to now) patch to the fontification of source block delimiters. [See http://osdir.com/ml/emacs-orgmode-gnu/2010-08/msg00550.html] Since Carsten applied it (2 weeks ago), the lines BEGIN_SRC and END_SRC were correctly highlighted from beginning of line to the end of it (right fringe, not last character "à la Ctrl-E"): --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC sh cd ~ wget http://www.mygooglest.com/fni/.emacs #+END_SRC --8<---------------cut here---------------end--------------->8--- To see what I mean, you need a font with background, for example: --8<---------------cut here---------------start------------->8--- (org-block ((t (:foreground "blue1" :background "#EAFFEA")))) (org-code ((t (:foreground "blue1" :background "#EAFFEA")))) (org-meta-line ((t (:foreground "#008ED1" :background "#FFEAEA")))) (org-table ((t (:foreground "blue1" :background "#EAEAFF")))) --8<---------------cut here---------------end--------------->8--- Today, with a pull 5 mins ago, the END_SRC line is "fully" highlighted, while the BEGIN_SRC line is only highlighted up to the last character on the line. 3. As well, what I've lost with this new (great) feature, is that, in the above shell code, `cd' is highlighted following the sh-mode, but all the code (here, 2 lines) are with no background -- while it was a nice full block for the 2 weeks I'm talking of. Would there be a way to add a _background color_ to the code blocks (can be unique and defined once, for all modes) that would be present, if no mode overrides that background color? > as to whether it should be on or off by default. On by default. For sure... even with my 2 last remarks. Thanks a lot! Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-02 15:51 ` Org now fontifies code blocks Dan Davison 2010-09-02 17:04 ` Erik Iverson 2010-09-02 20:26 ` Org now fontifies " Sébastien Vauban @ 2010-09-03 17:30 ` Eric S Fraga 2010-09-03 19:10 ` Thomas S. Dye 2010-09-06 16:59 ` Richard Riley 2 siblings, 2 replies; 56+ messages in thread From: Eric S Fraga @ 2010-09-03 17:30 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 462 bytes --] On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: > > I've just pushed changes which mean that Org now fontifies code in code > blocks. Currently, this is turned on by default, so it would be helpful > if people could report any problems, and opinions as to whether it > should be on or off by default. [...] This is brilliant! Works very well on my notebook (with small code blocks as that's all I tend to have). Many thanks! [-- Attachment #2: Type: text/plain, Size: 75 bytes --] -- Eric S Fraga GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-03 17:30 ` Eric S Fraga @ 2010-09-03 19:10 ` Thomas S. Dye 2010-09-06 16:49 ` David O'Toole 2010-09-07 13:23 ` Dan Davison 2010-09-06 16:59 ` Richard Riley 1 sibling, 2 replies; 56+ messages in thread From: Thomas S. Dye @ 2010-09-03 19:10 UTC (permalink / raw) To: e.fraga; +Cc: Dan Davison, emacs-orgmode Mailinglist Aloha Dan, This is really nice. Thanks for shepherding it along. In some of my use cases there is a substantial delay when opening a large file and then unfolding sections with many source code blocks. I don't mind this and intend to keep the feature on, but I do think it should be off by default because the user potentially pays an appreciable time penalty for the pleasure of semantic source code markup. Thanks again for this nice feature. All the best, Tom On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: > On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk > > wrote: >> >> I've just pushed changes which mean that Org now fontifies code in >> code >> blocks. Currently, this is turned on by default, so it would be >> helpful >> if people could report any problems, and opinions as to whether it >> should be on or off by default. > > [...] > > This is brilliant! Works very well on my notebook (with small code > blocks as that's all I tend to have). Many thanks! > -- > Eric S Fraga > GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-03 19:10 ` Thomas S. Dye @ 2010-09-06 16:49 ` David O'Toole 2010-09-07 13:23 ` Dan Davison 1 sibling, 0 replies; 56+ messages in thread From: David O'Toole @ 2010-09-06 16:49 UTC (permalink / raw) To: Thomas S. Dye; +Cc: Dan Davison, emacs-orgmode Mailinglist hi everyone, sorry for my silence, I had very little internet access on my seaside vacation. thanks so much everyone for making my dream of fontified source blocks a reality :) On Fri, Sep 3, 2010 at 3:10 PM, Thomas S. Dye <tsd@tsdye.com> wrote: > Aloha Dan, > > This is really nice. Thanks for shepherding it along. > > In some of my use cases there is a substantial delay when opening a large > file and then unfolding sections with many source code blocks. I don't mind > this and intend to keep the feature on, but I do think it should be off by > default because the user potentially pays an appreciable time penalty for > the pleasure of semantic source code markup. > > Thanks again for this nice feature. > > All the best, > Tom > > On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> >> wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> [...] >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! >> -- >> Eric S Fraga >> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >> _______________________________________________ >> 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-03 19:10 ` Thomas S. Dye 2010-09-06 16:49 ` David O'Toole @ 2010-09-07 13:23 ` Dan Davison 2010-09-07 13:55 ` Richard Riley 2010-09-07 16:05 ` Thomas S. Dye 1 sibling, 2 replies; 56+ messages in thread From: Dan Davison @ 2010-09-07 13:23 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode Mailinglist "Thomas S. Dye" <tsd@tsdye.com> writes: > Aloha Dan, > > This is really nice. Thanks for shepherding it along. > > In some of my use cases there is a substantial delay when opening a > large file and then unfolding sections with many source code blocks. Hi Tom, I think this is a good point and probably as you say a reason for turning it off by default. Org should be (and was!) lightweight by default. I haven't had time to profile things properly. Before we turn it off, could you please confirm that all your slowness problems go away when you do (setq org-src-fontify-natively nil)? Thanks, Dan > I don't mind this and intend to keep the feature on, but I do think it > should be off by default because the user potentially pays an > appreciable time penalty for the pleasure of semantic source code > markup. > > Thanks again for this nice feature. > > All the best, > Tom > > On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >> <davison@stats.ox.ac.uk >> > wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in >>> code >>> blocks. Currently, this is turned on by default, so it would be >>> helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> [...] >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! >> -- >> Eric S Fraga >> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >> _______________________________________________ >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 13:23 ` Dan Davison @ 2010-09-07 13:55 ` Richard Riley 2010-09-07 16:05 ` Thomas S. Dye 1 sibling, 0 replies; 56+ messages in thread From: Richard Riley @ 2010-09-07 13:55 UTC (permalink / raw) To: emacs-orgmode Dan Davison <davison@stats.ox.ac.uk> writes: > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> Aloha Dan, >> >> This is really nice. Thanks for shepherding it along. >> >> In some of my use cases there is a substantial delay when opening a >> large file and then unfolding sections with many source code blocks. > > Hi Tom, > > I think this is a good point and probably as you say a reason for > turning it off by default. Org should be (and was!) lightweight by > default. > On a more general level, I'm guessing this means emacs does not defer fortification until a buffer displays? Is that a result of fonts etc being generalised properties of buffer text? ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 13:23 ` Dan Davison 2010-09-07 13:55 ` Richard Riley @ 2010-09-07 16:05 ` Thomas S. Dye 2010-09-08 16:36 ` Darlan Cavalcante Moreira 1 sibling, 1 reply; 56+ messages in thread From: Thomas S. Dye @ 2010-09-07 16:05 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist Hi Dan, Yes, I can confirm that (setq org-src-fontify-natively nil) makes unfolding snappy again. All the best, Tom On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> Aloha Dan, >> >> This is really nice. Thanks for shepherding it along. >> >> In some of my use cases there is a substantial delay when opening a >> large file and then unfolding sections with many source code blocks. > > Hi Tom, > > I think this is a good point and probably as you say a reason for > turning it off by default. Org should be (and was!) lightweight by > default. > > I haven't had time to profile things properly. Before we turn it off, > could you please confirm that all your slowness problems go away when > you do (setq org-src-fontify-natively nil)? > > Thanks, > > Dan > > >> I don't mind this and intend to keep the feature on, but I do think >> it >> should be off by default because the user potentially pays an >> appreciable time penalty for the pleasure of semantic source code >> markup. >> >> Thanks again for this nice feature. >> >> All the best, >> Tom >> >> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >> >>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>> <davison@stats.ox.ac.uk >>>> wrote: >>>> >>>> I've just pushed changes which mean that Org now fontifies code in >>>> code >>>> blocks. Currently, this is turned on by default, so it would be >>>> helpful >>>> if people could report any problems, and opinions as to whether it >>>> should be on or off by default.< >>> >>> [...] >>> >>> This is brilliant! Works very well on my notebook (with small code >>> blocks as that's all I tend to have). Many thanks! >>> -- >>> Eric S Fraga >>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>> _______________________________________________ >>> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 16:05 ` Thomas S. Dye @ 2010-09-08 16:36 ` Darlan Cavalcante Moreira 2010-09-08 17:41 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Darlan Cavalcante Moreira @ 2010-09-08 16:36 UTC (permalink / raw) To: Thomas S. Dye; +Cc: Dan Davison, emacs-orgmode Mailinglist Maybe my problem is not related to slow folding/unfolding behavior that you are getting, but if I set the org-src-tab-acts-natively variable to t the folding/unfolding of headlines becomes very slow for me. In fact, I was thinking that I had the problem described here, but I just isolated the cause and in my case it was the org-src-tab-acts-natively variable that I had set to t in my .emacs file. -- Darlan At Tue, 7 Sep 2010 06:05:54 -1000, "Thomas S. Dye" <tsd@tsdye.com> wrote: > > Hi Dan, > > Yes, I can confirm that (setq org-src-fontify-natively nil) makes > unfolding snappy again. > > All the best, > Tom > > On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: > > > "Thomas S. Dye" <tsd@tsdye.com> writes: > > > >> Aloha Dan, > >> > >> This is really nice. Thanks for shepherding it along. > >> > >> In some of my use cases there is a substantial delay when opening a > >> large file and then unfolding sections with many source code blocks. > > > > Hi Tom, > > > > I think this is a good point and probably as you say a reason for > > turning it off by default. Org should be (and was!) lightweight by > > default. > > > > I haven't had time to profile things properly. Before we turn it off, > > could you please confirm that all your slowness problems go away when > > you do (setq org-src-fontify-natively nil)? > > > > Thanks, > > > > Dan > > > > > >> I don't mind this and intend to keep the feature on, but I do think > >> it > >> should be off by default because the user potentially pays an > >> appreciable time penalty for the pleasure of semantic source code > >> markup. > >> > >> Thanks again for this nice feature. > >> > >> All the best, > >> Tom > >> > >> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: > >> > >>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison > >>> <davison@stats.ox.ac.uk > >>>> wrote: > >>>> > >>>> I've just pushed changes which mean that Org now fontifies code in > >>>> code > >>>> blocks. Currently, this is turned on by default, so it would be > >>>> helpful > >>>> if people could report any problems, and opinions as to whether it > >>>> should be on or off by default.< > >>> > >>> [...] > >>> > >>> This is brilliant! Works very well on my notebook (with small code > >>> blocks as that's all I tend to have). Many thanks! > >>> -- > >>> Eric S Fraga > >>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D > >>> _______________________________________________ > >>> 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 > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-08 16:36 ` Darlan Cavalcante Moreira @ 2010-09-08 17:41 ` Dan Davison 2010-09-09 13:02 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-08 17:41 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: emacs-orgmode Mailinglist Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > Maybe my problem is not related to slow folding/unfolding behavior that you > are getting, but if I set the org-src-tab-acts-natively variable to t the > folding/unfolding of headlines becomes very slow for me. Thank you Darlan, I have just pushed a change that should make that better -- does that improve things? I did think there was something else going on (that was why I asked Tom for confirmation), but I didn't have time to investigate properly. The problem seems to be that, on a folded headline containing many blocks, `org-edit-src-find-region-and-lang' is actually quite slow to come up with the answer "No, there's nothing for me to edit here." (try issuing M-x org-edit-src-code on a folded headline containing many blocks; I haven't understood this properly yet.) Dan > > In fact, I was thinking that I had the problem described here, but I just > isolated the cause and in my case it was the org-src-tab-acts-natively > variable that I had set to t in my .emacs file. > > -- > Darlan > > At Tue, 7 Sep 2010 06:05:54 -1000, > "Thomas S. Dye" <tsd@tsdye.com> wrote: >> >> Hi Dan, >> >> Yes, I can confirm that (setq org-src-fontify-natively nil) makes >> unfolding snappy again. >> >> All the best, >> Tom >> >> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >> >> > "Thomas S. Dye" <tsd@tsdye.com> writes: >> > >> >> Aloha Dan, >> >> >> >> This is really nice. Thanks for shepherding it along. >> >> >> >> In some of my use cases there is a substantial delay when opening a >> >> large file and then unfolding sections with many source code blocks. >> > >> > Hi Tom, >> > >> > I think this is a good point and probably as you say a reason for >> > turning it off by default. Org should be (and was!) lightweight by >> > default. >> > >> > I haven't had time to profile things properly. Before we turn it off, >> > could you please confirm that all your slowness problems go away when >> > you do (setq org-src-fontify-natively nil)? >> > >> > Thanks, >> > >> > Dan >> > >> > >> >> I don't mind this and intend to keep the feature on, but I do think >> >> it >> >> should be off by default because the user potentially pays an >> >> appreciable time penalty for the pleasure of semantic source code >> >> markup. >> >> >> >> Thanks again for this nice feature. >> >> >> >> All the best, >> >> Tom >> >> >> >> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >> >> >> >>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >> >>> <davison@stats.ox.ac.uk >> >>>> wrote: >> >>>> >> >>>> I've just pushed changes which mean that Org now fontifies code in >> >>>> code >> >>>> blocks. Currently, this is turned on by default, so it would be >> >>>> helpful >> >>>> if people could report any problems, and opinions as to whether it >> >>>> should be on or off by default.< >> >>> >> >>> [...] >> >>> >> >>> This is brilliant! Works very well on my notebook (with small code >> >>> blocks as that's all I tend to have). Many thanks! >> >>> -- >> >>> Eric S Fraga >> >>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >> >>> _______________________________________________ >> >>> 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 >> >> >> _______________________________________________ >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-08 17:41 ` Dan Davison @ 2010-09-09 13:02 ` Darlan Cavalcante Moreira 2010-09-09 21:40 ` Thomas S. Dye 0 siblings, 1 reply; 56+ messages in thread From: Darlan Cavalcante Moreira @ 2010-09-09 13:02 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist Thank you Dan, It is perfect now. No perceivable slowdown At Wed, 08 Sep 2010 13:41:51 -0400, Dan Davison wrote: > > Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > > > Maybe my problem is not related to slow folding/unfolding behavior that you > > are getting, but if I set the org-src-tab-acts-natively variable to t the > > folding/unfolding of headlines becomes very slow for me. > > Thank you Darlan, > > I have just pushed a change that should make that better -- does that > improve things? > > I did think there was something else going on (that was why I asked Tom > for confirmation), but I didn't have time to investigate properly. The > problem seems to be that, on a folded headline containing many blocks, > `org-edit-src-find-region-and-lang' is actually quite slow to come up > with the answer "No, there's nothing for me to edit here." (try issuing > M-x org-edit-src-code on a folded headline containing many blocks; I > haven't understood this properly yet.) > > Dan > > > > > > > In fact, I was thinking that I had the problem described here, but I just > > isolated the cause and in my case it was the org-src-tab-acts-natively > > variable that I had set to t in my .emacs file. > > > > -- > > Darlan > > > > At Tue, 7 Sep 2010 06:05:54 -1000, > > "Thomas S. Dye" <tsd@tsdye.com> wrote: > >> > >> Hi Dan, > >> > >> Yes, I can confirm that (setq org-src-fontify-natively nil) makes > >> unfolding snappy again. > >> > >> All the best, > >> Tom > >> > >> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: > >> > >> > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> > > >> >> Aloha Dan, > >> >> > >> >> This is really nice. Thanks for shepherding it along. > >> >> > >> >> In some of my use cases there is a substantial delay when opening a > >> >> large file and then unfolding sections with many source code blocks. > >> > > >> > Hi Tom, > >> > > >> > I think this is a good point and probably as you say a reason for > >> > turning it off by default. Org should be (and was!) lightweight by > >> > default. > >> > > >> > I haven't had time to profile things properly. Before we turn it off, > >> > could you please confirm that all your slowness problems go away when > >> > you do (setq org-src-fontify-natively nil)? > >> > > >> > Thanks, > >> > > >> > Dan > >> > > >> > > >> >> I don't mind this and intend to keep the feature on, but I do think > >> >> it > >> >> should be off by default because the user potentially pays an > >> >> appreciable time penalty for the pleasure of semantic source code > >> >> markup. > >> >> > >> >> Thanks again for this nice feature. > >> >> > >> >> All the best, > >> >> Tom > >> >> > >> >> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: > >> >> > >> >>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison > >> >>> <davison@stats.ox.ac.uk > >> >>>> wrote: > >> >>>> > >> >>>> I've just pushed changes which mean that Org now fontifies code in > >> >>>> code > >> >>>> blocks. Currently, this is turned on by default, so it would be > >> >>>> helpful > >> >>>> if people could report any problems, and opinions as to whether it > >> >>>> should be on or off by default.< > >> >>> > >> >>> [...] > >> >>> > >> >>> This is brilliant! Works very well on my notebook (with small code > >> >>> blocks as that's all I tend to have). Many thanks! > >> >>> -- > >> >>> Eric S Fraga > >> >>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D > >> >>> _______________________________________________ > >> >>> 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 > >> > >> > >> _______________________________________________ > >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-09 13:02 ` Darlan Cavalcante Moreira @ 2010-09-09 21:40 ` Thomas S. Dye 2010-09-09 22:35 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Thomas S. Dye @ 2010-09-09 21:40 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Dan Davison, emacs-orgmode Mailinglist Hi Dan, Glad to know that Darlan's slowdown is fixed. No change here that I can tell. Now that I've had org-src-fontify- natively set to t for a while, I can see that the slowdown is proportional to the number and size of code blocks in the Org-mode file. It is most noticeable in a file with about 30 printed pages of a manuscript held in several dozen LaTeX code blocks, quite a bit less so in a file where the several dozen code blocks are short R routines. FWIW, I see the org-src-fontification message while unfolding, even when the unfolded result doesn't show a code block. Later when a sub- tree is unfolded, the org-src-fontification message appears again, which makes me wonder if there is unnecessary work going on. All the best, Tom On Sep 9, 2010, at 3:02 AM, Darlan Cavalcante Moreira wrote: > > Thank you Dan, > > It is perfect now. No perceivable slowdown > > At Wed, 08 Sep 2010 13:41:51 -0400, > Dan Davison wrote: >> >> Darlan Cavalcante Moreira <darcamo@gmail.com> writes: >> >>> Maybe my problem is not related to slow folding/unfolding behavior >>> that you >>> are getting, but if I set the org-src-tab-acts-natively variable >>> to t the >>> folding/unfolding of headlines becomes very slow for me. >> >> Thank you Darlan, >> >> I have just pushed a change that should make that better -- does that >> improve things? >> >> I did think there was something else going on (that was why I asked >> Tom >> for confirmation), but I didn't have time to investigate properly. >> The >> problem seems to be that, on a folded headline containing many >> blocks, >> `org-edit-src-find-region-and-lang' is actually quite slow to come up >> with the answer "No, there's nothing for me to edit here." (try >> issuing >> M-x org-edit-src-code on a folded headline containing many blocks; I >> haven't understood this properly yet.) >> >> Dan >> >> >> >>> >>> In fact, I was thinking that I had the problem described here, but >>> I just >>> isolated the cause and in my case it was the org-src-tab-acts- >>> natively >>> variable that I had set to t in my .emacs file. >>> >>> -- >>> Darlan >>> >>> At Tue, 7 Sep 2010 06:05:54 -1000, >>> "Thomas S. Dye" <tsd@tsdye.com> wrote: >>>> >>>> Hi Dan, >>>> >>>> Yes, I can confirm that (setq org-src-fontify-natively nil) makes >>>> unfolding snappy again. >>>> >>>> All the best, >>>> Tom >>>> >>>> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >>>> >>>>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>>>> >>>>>> Aloha Dan, >>>>>> >>>>>> This is really nice. Thanks for shepherding it along. >>>>>> >>>>>> In some of my use cases there is a substantial delay when >>>>>> opening a >>>>>> large file and then unfolding sections with many source code >>>>>> blocks. >>>>> >>>>> Hi Tom, >>>>> >>>>> I think this is a good point and probably as you say a reason for >>>>> turning it off by default. Org should be (and was!) lightweight by >>>>> default. >>>>> >>>>> I haven't had time to profile things properly. Before we turn it >>>>> off, >>>>> could you please confirm that all your slowness problems go away >>>>> when >>>>> you do (setq org-src-fontify-natively nil)? >>>>> >>>>> Thanks, >>>>> >>>>> Dan >>>>> >>>>> >>>>>> I don't mind this and intend to keep the feature on, but I do >>>>>> think >>>>>> it >>>>>> should be off by default because the user potentially pays an >>>>>> appreciable time penalty for the pleasure of semantic source code >>>>>> markup. >>>>>> >>>>>> Thanks again for this nice feature. >>>>>> >>>>>> All the best, >>>>>> Tom >>>>>> >>>>>> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >>>>>> >>>>>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>>>>>> <davison@stats.ox.ac.uk >>>>>>>> wrote: >>>>>>>> >>>>>>>> I've just pushed changes which mean that Org now fontifies >>>>>>>> code in >>>>>>>> code >>>>>>>> blocks. Currently, this is turned on by default, so it would be >>>>>>>> helpful >>>>>>>> if people could report any problems, and opinions as to >>>>>>>> whether it >>>>>>>> should be on or off by default.< >>>>>>> >>>>>>> [...] >>>>>>> >>>>>>> This is brilliant! Works very well on my notebook (with small >>>>>>> code >>>>>>> blocks as that's all I tend to have). Many thanks! >>>>>>> -- >>>>>>> Eric S Fraga >>>>>>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>>>>>> _______________________________________________ >>>>>>> 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 >>>> >>>> >>>> _______________________________________________ >>>> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-09 21:40 ` Thomas S. Dye @ 2010-09-09 22:35 ` Dan Davison 2010-09-09 23:03 ` Thomas S. Dye 0 siblings, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-09 22:35 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode Mailinglist "Thomas S. Dye" <tsd@tsdye.com> writes: > Hi Dan, > > Glad to know that Darlan's slowdown is fixed. > > No change here that I can tell. Now that I've had org-src-fontify- > natively set to t for a while, I can see that the slowdown is > proportional to the number and size of code blocks in the Org-mode > file. It is most noticeable in a file with about 30 printed pages of > a manuscript held in several dozen LaTeX code blocks, quite a bit less > so in a file where the several dozen code blocks are short R routines. > > FWIW, I see the org-src-fontification message while unfolding, Hi Tom, Could you post that message please (go to *Messages* buffer after unfolding and it should be there). I haven't put any messages in, but I think I know the message you mean and I think it is an Emacs message. Dan > even > when the unfolded result doesn't show a code block. Later when a sub- > tree is unfolded, the org-src-fontification message appears again, > which makes me wonder if there is unnecessary work going on. > > All the best, > Tom > > On Sep 9, 2010, at 3:02 AM, Darlan Cavalcante Moreira wrote: > >> >> Thank you Dan, >> >> It is perfect now. No perceivable slowdown >> >> At Wed, 08 Sep 2010 13:41:51 -0400, >> Dan Davison wrote: >>> >>> Darlan Cavalcante Moreira <darcamo@gmail.com> writes: >>> >>>> Maybe my problem is not related to slow folding/unfolding behavior >>>> that you >>>> are getting, but if I set the org-src-tab-acts-natively variable >>>> to t the >>>> folding/unfolding of headlines becomes very slow for me. >>> >>> Thank you Darlan, >>> >>> I have just pushed a change that should make that better -- does that >>> improve things? >>> >>> I did think there was something else going on (that was why I asked >>> Tom >>> for confirmation), but I didn't have time to investigate >>> properly. The >>> problem seems to be that, on a folded headline containing many >>> blocks, >>> `org-edit-src-find-region-and-lang' is actually quite slow to come up >>> with the answer "No, there's nothing for me to edit here." (try >>> issuing >>> M-x org-edit-src-code on a folded headline containing many blocks; I >>> haven't understood this properly yet.) >>> >>> Dan >>> >>> >>> >>>> >>>> In fact, I was thinking that I had the problem described here, but >>>> I just >>>> isolated the cause and in my case it was the org-src-tab-acts- >>>> natively >>>> variable that I had set to t in my .emacs file. >>>> >>>> -- >>>> Darlan >>>> >>>> At Tue, 7 Sep 2010 06:05:54 -1000, >>>> "Thomas S. Dye" <tsd@tsdye.com> wrote: >>>>> >>>>> Hi Dan, >>>>> >>>>> Yes, I can confirm that (setq org-src-fontify-natively nil) makes >>>>> unfolding snappy again. >>>>> >>>>> All the best, >>>>> Tom >>>>> >>>>> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >>>>> >>>>>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>>>>> >>>>>>> Aloha Dan, >>>>>>> >>>>>>> This is really nice. Thanks for shepherding it along. >>>>>>> >>>>>>> In some of my use cases there is a substantial delay when >>>>>>> opening a >>>>>>> large file and then unfolding sections with many source code >>>>>>> blocks. >>>>>> >>>>>> Hi Tom, >>>>>> >>>>>> I think this is a good point and probably as you say a reason for >>>>>> turning it off by default. Org should be (and was!) lightweight by >>>>>> default. >>>>>> >>>>>> I haven't had time to profile things properly. Before we turn it >>>>>> off, >>>>>> could you please confirm that all your slowness problems go away >>>>>> when >>>>>> you do (setq org-src-fontify-natively nil)? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>>> I don't mind this and intend to keep the feature on, but I do >>>>>>> think >>>>>>> it >>>>>>> should be off by default because the user potentially pays an >>>>>>> appreciable time penalty for the pleasure of semantic source code >>>>>>> markup. >>>>>>> >>>>>>> Thanks again for this nice feature. >>>>>>> >>>>>>> All the best, >>>>>>> Tom >>>>>>> >>>>>>> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >>>>>>> >>>>>>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>>>>>>> <davison@stats.ox.ac.uk >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>> I've just pushed changes which mean that Org now fontifies >>>>>>>>> code in >>>>>>>>> code >>>>>>>>> blocks. Currently, this is turned on by default, so it would be >>>>>>>>> helpful >>>>>>>>> if people could report any problems, and opinions as to >>>>>>>>> whether it >>>>>>>>> should be on or off by default.< >>>>>>>> >>>>>>>> [...] >>>>>>>> >>>>>>>> This is brilliant! Works very well on my notebook (with small >>>>>>>> code >>>>>>>> blocks as that's all I tend to have). Many thanks! >>>>>>>> -- >>>>>>>> Eric S Fraga >>>>>>>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>>>>>>> _______________________________________________ >>>>>>>> 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 >>>>> >>>>> >>>>> _______________________________________________ >>>>> 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 > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-09 22:35 ` Dan Davison @ 2010-09-09 23:03 ` Thomas S. Dye 2010-10-28 11:10 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Thomas S. Dye @ 2010-09-09 23:03 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Mailinglist On Sep 9, 2010, at 12:35 PM, Dan Davison wrote: > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> Hi Dan, >> >> Glad to know that Darlan's slowdown is fixed. >> >> No change here that I can tell. Now that I've had org-src-fontify- >> natively set to t for a while, I can see that the slowdown is >> proportional to the number and size of code blocks in the Org-mode >> file. It is most noticeable in a file with about 30 printed pages of >> a manuscript held in several dozen LaTeX code blocks, quite a bit >> less >> so in a file where the several dozen code blocks are short R >> routines. >> >> FWIW, I see the org-src-fontification message while unfolding, > > Hi Tom, > > Could you post that message please (go to *Messages* buffer after > unfolding and it should be there). I haven't put any messages in, > but I > think I know the message you mean and I think it is an Emacs message. > > Dan > Hi Dan, Yes, here is a portion of the message buffer: Searching for `makaainana.org'.... Automatic display of crossref information was turned on Fontifying org-src-fontification:latex-mode... (regexps.............................) Automatic display of crossref information was turned on Fontifying org-src-fontification:latex-mode... (regexps.............................) Automatic display of crossref information was turned on Fontifying org-src-fontification:latex-mode... (regexps.............................) Automatic display of crossref information was turned on Fontifying org-src-fontification:latex-mode... (regexps.............................) Automatic display of crossref information was turned on Fontifying org-src-fontification:latex-mode... (regexps.............................) Quit I believe the message comes from line 744 of org-src.el All the best, Tom >> even >> when the unfolded result doesn't show a code block. Later when a >> sub- >> tree is unfolded, the org-src-fontification message appears again, >> which makes me wonder if there is unnecessary work going on. >> >> All the best, >> Tom >> >> On Sep 9, 2010, at 3:02 AM, Darlan Cavalcante Moreira wrote: >> >>> >>> Thank you Dan, >>> >>> It is perfect now. No perceivable slowdown >>> >>> At Wed, 08 Sep 2010 13:41:51 -0400, >>> Dan Davison wrote: >>>> >>>> Darlan Cavalcante Moreira <darcamo@gmail.com> writes: >>>> >>>>> Maybe my problem is not related to slow folding/unfolding behavior >>>>> that you >>>>> are getting, but if I set the org-src-tab-acts-natively variable >>>>> to t the >>>>> folding/unfolding of headlines becomes very slow for me. >>>> >>>> Thank you Darlan, >>>> >>>> I have just pushed a change that should make that better -- does >>>> that >>>> improve things? >>>> >>>> I did think there was something else going on (that was why I asked >>>> Tom >>>> for confirmation), but I didn't have time to investigate >>>> properly. The >>>> problem seems to be that, on a folded headline containing many >>>> blocks, >>>> `org-edit-src-find-region-and-lang' is actually quite slow to >>>> come up >>>> with the answer "No, there's nothing for me to edit here." (try >>>> issuing >>>> M-x org-edit-src-code on a folded headline containing many >>>> blocks; I >>>> haven't understood this properly yet.) >>>> >>>> Dan >>>> >>>> >>>> >>>>> >>>>> In fact, I was thinking that I had the problem described here, but >>>>> I just >>>>> isolated the cause and in my case it was the org-src-tab-acts- >>>>> natively >>>>> variable that I had set to t in my .emacs file. >>>>> >>>>> -- >>>>> Darlan >>>>> >>>>> At Tue, 7 Sep 2010 06:05:54 -1000, >>>>> "Thomas S. Dye" <tsd@tsdye.com> wrote: >>>>>> >>>>>> Hi Dan, >>>>>> >>>>>> Yes, I can confirm that (setq org-src-fontify-natively nil) makes >>>>>> unfolding snappy again. >>>>>> >>>>>> All the best, >>>>>> Tom >>>>>> >>>>>> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >>>>>> >>>>>>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>>>>>> >>>>>>>> Aloha Dan, >>>>>>>> >>>>>>>> This is really nice. Thanks for shepherding it along. >>>>>>>> >>>>>>>> In some of my use cases there is a substantial delay when >>>>>>>> opening a >>>>>>>> large file and then unfolding sections with many source code >>>>>>>> blocks. >>>>>>> >>>>>>> Hi Tom, >>>>>>> >>>>>>> I think this is a good point and probably as you say a reason >>>>>>> for >>>>>>> turning it off by default. Org should be (and was!) >>>>>>> lightweight by >>>>>>> default. >>>>>>> >>>>>>> I haven't had time to profile things properly. Before we turn it >>>>>>> off, >>>>>>> could you please confirm that all your slowness problems go away >>>>>>> when >>>>>>> you do (setq org-src-fontify-natively nil)? >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Dan >>>>>>> >>>>>>> >>>>>>>> I don't mind this and intend to keep the feature on, but I do >>>>>>>> think >>>>>>>> it >>>>>>>> should be off by default because the user potentially pays an >>>>>>>> appreciable time penalty for the pleasure of semantic source >>>>>>>> code >>>>>>>> markup. >>>>>>>> >>>>>>>> Thanks again for this nice feature. >>>>>>>> >>>>>>>> All the best, >>>>>>>> Tom >>>>>>>> >>>>>>>> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >>>>>>>> >>>>>>>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>>>>>>>> <davison@stats.ox.ac.uk >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> I've just pushed changes which mean that Org now fontifies >>>>>>>>>> code in >>>>>>>>>> code >>>>>>>>>> blocks. Currently, this is turned on by default, so it >>>>>>>>>> would be >>>>>>>>>> helpful >>>>>>>>>> if people could report any problems, and opinions as to >>>>>>>>>> whether it >>>>>>>>>> should be on or off by default.< >>>>>>>>> >>>>>>>>> [...] >>>>>>>>> >>>>>>>>> This is brilliant! Works very well on my notebook (with small >>>>>>>>> code >>>>>>>>> blocks as that's all I tend to have). Many thanks! >>>>>>>>> -- >>>>>>>>> Eric S Fraga >>>>>>>>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>>>>>>>> _______________________________________________ >>>>>>>>> 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 >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >> >> >> _______________________________________________ >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-09 23:03 ` Thomas S. Dye @ 2010-10-28 11:10 ` Dan Davison 2010-10-28 12:08 ` Jules Bean 2010-10-28 16:24 ` Thomas S. Dye 0 siblings, 2 replies; 56+ messages in thread From: Dan Davison @ 2010-10-28 11:10 UTC (permalink / raw) To: Thomas S. Dye; +Cc: Dan Davison, emacs-orgmode Mailinglist "Thomas S. Dye" <tsd@tsdye.com> writes: > On Sep 9, 2010, at 12:35 PM, Dan Davison wrote: > >> "Thomas S. Dye" <tsd@tsdye.com> writes: >> >>> Hi Dan, >>> >>> Glad to know that Darlan's slowdown is fixed. >>> >>> No change here that I can tell. Now that I've had org-src-fontify- >>> natively set to t for a while, I can see that the slowdown is >>> proportional to the number and size of code blocks in the Org-mode >>> file. It is most noticeable in a file with about 30 printed pages of >>> a manuscript held in several dozen LaTeX code blocks, quite a bit >>> less >>> so in a file where the several dozen code blocks are short R >>> routines. Hi Tom, I've used fontification in Org code blocks constantly for a couple of months now, and I do not agree that there are any editing or unfolding delays which should deter typical Org users from using fontified src blocks. In typical usage I do not experience any delays whatsoever (my blocks tend to be fewer than 100 lines in length). I have tested a file with 22000 lines containing two subtrees of 59 latex blocks each of length 190 lines. Opening the file takes perhaps 4 seconds as opposed to 1. And unfolding one of the 11,000 line subtrees for the first time sometimes takes 1-2 seconds. However, once the file is open and being used, folding and unfolding of blocks is snappy. Editing and fontification is immediate in the 190 line blocks. When editing in a 2088 line block, there is an almost 1 second delay for a fontified character to appear, which is no good at all -- but I think users of blocks of that size should be happy using C-c '. I do not get any fontification messages in the minibuffer. This is on a slow machine (an Intel atom netbook), with emacs23 and emacs24 running under linux. So even in my 22000 line file containing 190 line blocks, the delays are short and only occur when first opening and unfolding the file. However, users of very large src blocks should definitely use C-c ' for editing. >>> FWIW, I see the org-src-fontification message while unfolding, [...] > Could you post that message please (go to *Messages* buffer after >> unfolding and it should be there). I haven't put any messages in, >> but I >> think I know the message you mean and I think it is an Emacs message. [...] > Yes, here is a portion of the message buffer: > > Searching for `makaainana.org'.... > Automatic display of crossref information was turned on > Fontifying > org-src-fontification:latex-mode... (regexps.............................) > Automatic display of crossref information was turned on [...] > I believe the message comes from line 744 of org-src.el No, the message comes from core Emacs fontification code. I'm unsure why you are seeing these messages and I am not. Do you still see the behaviour/problems you reported above? Dan > > All the best, > Tom >>> even >>> when the unfolded result doesn't show a code block. Later when a >>> sub- >>> tree is unfolded, the org-src-fontification message appears again, >>> which makes me wonder if there is unnecessary work going on. >>> >>> All the best, >>> Tom >>> >>> On Sep 9, 2010, at 3:02 AM, Darlan Cavalcante Moreira wrote: >>> >>>> >>>> Thank you Dan, >>>> >>>> It is perfect now. No perceivable slowdown >>>> >>>> At Wed, 08 Sep 2010 13:41:51 -0400, >>>> Dan Davison wrote: >>>>> >>>>> Darlan Cavalcante Moreira <darcamo@gmail.com> writes: >>>>> >>>>>> Maybe my problem is not related to slow folding/unfolding behavior >>>>>> that you >>>>>> are getting, but if I set the org-src-tab-acts-natively variable >>>>>> to t the >>>>>> folding/unfolding of headlines becomes very slow for me. >>>>> >>>>> Thank you Darlan, >>>>> >>>>> I have just pushed a change that should make that better -- does >>>>> that >>>>> improve things? >>>>> >>>>> I did think there was something else going on (that was why I asked >>>>> Tom >>>>> for confirmation), but I didn't have time to investigate >>>>> properly. The >>>>> problem seems to be that, on a folded headline containing many >>>>> blocks, >>>>> `org-edit-src-find-region-and-lang' is actually quite slow to >>>>> come up >>>>> with the answer "No, there's nothing for me to edit here." (try >>>>> issuing >>>>> M-x org-edit-src-code on a folded headline containing many >>>>> blocks; I >>>>> haven't understood this properly yet.) >>>>> >>>>> Dan >>>>> >>>>> >>>>> >>>>>> >>>>>> In fact, I was thinking that I had the problem described here, but >>>>>> I just >>>>>> isolated the cause and in my case it was the org-src-tab-acts- >>>>>> natively >>>>>> variable that I had set to t in my .emacs file. >>>>>> >>>>>> -- >>>>>> Darlan >>>>>> >>>>>> At Tue, 7 Sep 2010 06:05:54 -1000, >>>>>> "Thomas S. Dye" <tsd@tsdye.com> wrote: >>>>>>> >>>>>>> Hi Dan, >>>>>>> >>>>>>> Yes, I can confirm that (setq org-src-fontify-natively nil) makes >>>>>>> unfolding snappy again. >>>>>>> >>>>>>> All the best, >>>>>>> Tom >>>>>>> >>>>>>> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >>>>>>> >>>>>>>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>>>>>>> >>>>>>>>> Aloha Dan, >>>>>>>>> >>>>>>>>> This is really nice. Thanks for shepherding it along. >>>>>>>>> >>>>>>>>> In some of my use cases there is a substantial delay when >>>>>>>>> opening a >>>>>>>>> large file and then unfolding sections with many source code >>>>>>>>> blocks. >>>>>>>> >>>>>>>> Hi Tom, >>>>>>>> >>>>>>>> I think this is a good point and probably as you say a reason >>>>>>>> for >>>>>>>> turning it off by default. Org should be (and was!) >>>>>>>> lightweight by >>>>>>>> default. >>>>>>>> >>>>>>>> I haven't had time to profile things properly. Before we turn it >>>>>>>> off, >>>>>>>> could you please confirm that all your slowness problems go away >>>>>>>> when >>>>>>>> you do (setq org-src-fontify-natively nil)? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> Dan >>>>>>>> >>>>>>>> >>>>>>>>> I don't mind this and intend to keep the feature on, but I do >>>>>>>>> think >>>>>>>>> it >>>>>>>>> should be off by default because the user potentially pays an >>>>>>>>> appreciable time penalty for the pleasure of semantic source >>>>>>>>> code >>>>>>>>> markup. >>>>>>>>> >>>>>>>>> Thanks again for this nice feature. >>>>>>>>> >>>>>>>>> All the best, >>>>>>>>> Tom >>>>>>>>> >>>>>>>>> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >>>>>>>>> >>>>>>>>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>>>>>>>>> <davison@stats.ox.ac.uk >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> I've just pushed changes which mean that Org now fontifies >>>>>>>>>>> code in >>>>>>>>>>> code >>>>>>>>>>> blocks. Currently, this is turned on by default, so it >>>>>>>>>>> would be >>>>>>>>>>> helpful >>>>>>>>>>> if people could report any problems, and opinions as to >>>>>>>>>>> whether it >>>>>>>>>>> should be on or off by default.< >>>>>>>>>> >>>>>>>>>> [...] >>>>>>>>>> >>>>>>>>>> This is brilliant! Works very well on my notebook (with small >>>>>>>>>> code >>>>>>>>>> blocks as that's all I tend to have). Many thanks! >>>>>>>>>> -- >>>>>>>>>> Eric S Fraga >>>>>>>>>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>>>>>>>>> _______________________________________________ >>>>>>>>>> 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 >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>> >>> >>> _______________________________________________ >>> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-10-28 11:10 ` Dan Davison @ 2010-10-28 12:08 ` Jules Bean 2010-10-28 12:47 ` Jambunathan K 2010-10-28 16:24 ` Thomas S. Dye 1 sibling, 1 reply; 56+ messages in thread From: Jules Bean @ 2010-10-28 12:08 UTC (permalink / raw) To: Dan Davison; +Cc: Dan Davison, emacs-orgmode Mailinglist > > Hi Tom, > > I've used fontification in Org code blocks constantly for a couple of > months now, and I do not agree that there are any editing or unfolding > delays which should deter typical Org users from using fontified src > blocks. In typical usage I do not experience any delays whatsoever (my > blocks tend to be fewer than 100 lines in length). > Is Tom perhaps using OSX? I found absurd fontification delays on OSX for various things (*clock task select* was the worst, IIRC) until somebody advised me to (setq font-lock-verbose nil), and that fixed it completely. I don't think it's the actual fontification that's slow, I think it's the (message) that is telling you what it's doing. Jules ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-10-28 12:08 ` Jules Bean @ 2010-10-28 12:47 ` Jambunathan K 2010-10-28 13:35 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Jambunathan K @ 2010-10-28 12:47 UTC (permalink / raw) To: Jules Bean; +Cc: Dan Davison, emacs-orgmode Mailinglist, Dan Davison Jules Bean <jules@jellybean.co.uk> writes: >> >> Hi Tom, >> >> I've used fontification in Org code blocks constantly for a couple of >> months now, and I do not agree that there are any editing or unfolding >> delays which should deter typical Org users from using fontified src >> blocks. In typical usage I do not experience any delays whatsoever (my >> blocks tend to be fewer than 100 lines in length). >> > > Is Tom perhaps using OSX? I found absurd fontification delays on OSX > for various things (*clock task select* was the worst, IIRC) until > somebody advised me to (setq font-lock-verbose nil), and that fixed it > completely. > > I don't think it's the actual fontification that's slow, I think it's > the (message) that is telling you what it's doing. I wonder whether fontification messages are relics of the age long past when they served as modern equivalents of progress bars. ,----[ C-h v font-lock-verbose RET ] | font-lock-verbose is a variable defined in `font-lock.el'. | Its value is 0 | | Documentation: | If non-nil, means show status messages for buffer fontification. | If a number, only buffers greater than this size have fontification messages. | | You can customize this variable. | | [back] `---- Perhaps Emacs maintainers would be willing to change the default setting of this variable. > > Jules > > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-10-28 12:47 ` Jambunathan K @ 2010-10-28 13:35 ` Dan Davison 0 siblings, 0 replies; 56+ messages in thread From: Dan Davison @ 2010-10-28 13:35 UTC (permalink / raw) To: Jambunathan K; +Cc: Jules Bean, Dan Davison, emacs-orgmode Mailinglist Jambunathan K <kjambunathan@gmail.com> writes: > Jules Bean <jules@jellybean.co.uk> writes: > >>> >>> Hi Tom, >>> >>> I've used fontification in Org code blocks constantly for a couple of >>> months now, and I do not agree that there are any editing or unfolding >>> delays which should deter typical Org users from using fontified src >>> blocks. In typical usage I do not experience any delays whatsoever (my >>> blocks tend to be fewer than 100 lines in length). >>> >> >> Is Tom perhaps using OSX? I found absurd fontification delays on OSX >> for various things (*clock task select* was the worst, IIRC) until >> somebody advised me to (setq font-lock-verbose nil), and that fixed it >> completely. Thanks Jules. I think I must have read the same advice, and now that you mention it, I have that set to nil in my .emacs.org. I do see Tom's messages when I set it to t. Hopefully setting to nil results in a speed-up in OSX? >> I don't think it's the actual fontification that's slow, I think it's >> the (message) that is telling you what it's doing. > Hi Jambunathan, > I wonder whether fontification messages are relics of the age long past > when they served as modern equivalents of progress bars. I think you may be right. > ,----[ C-h v font-lock-verbose RET ] > | font-lock-verbose is a variable defined in `font-lock.el'. > | Its value is 0 > | > | Documentation: > | If non-nil, means show status messages for buffer fontification. > | If a number, only buffers greater than this size have fontification messages. > | > | You can customize this variable. > | > | [back] > `---- > > Perhaps Emacs maintainers would be willing to change the default setting > of this variable. That sounds like a sensible suggestion. Dan > >> >> Jules >> >> >> >> _______________________________________________ >> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-10-28 11:10 ` Dan Davison 2010-10-28 12:08 ` Jules Bean @ 2010-10-28 16:24 ` Thomas S. Dye 1 sibling, 0 replies; 56+ messages in thread From: Thomas S. Dye @ 2010-10-28 16:24 UTC (permalink / raw) To: Dan Davison; +Cc: Dan Davison, emacs-orgmode Mailinglist On Oct 28, 2010, at 1:10 AM, Dan Davison wrote: > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> On Sep 9, 2010, at 12:35 PM, Dan Davison wrote: >> >>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>> >>>> Hi Dan, >>>> >>>> Glad to know that Darlan's slowdown is fixed. >>>> >>>> No change here that I can tell. Now that I've had org-src-fontify- >>>> natively set to t for a while, I can see that the slowdown is >>>> proportional to the number and size of code blocks in the Org-mode >>>> file. It is most noticeable in a file with about 30 printed >>>> pages of >>>> a manuscript held in several dozen LaTeX code blocks, quite a bit >>>> less >>>> so in a file where the several dozen code blocks are short R >>>> routines. > > Hi Tom, > > I've used fontification in Org code blocks constantly for a couple of > months now, and I do not agree that there are any editing or unfolding > delays which should deter typical Org users from using fontified src > blocks. In typical usage I do not experience any delays whatsoever (my > blocks tend to be fewer than 100 lines in length). > > I have tested a file with 22000 lines containing two subtrees of 59 > latex blocks each of length 190 lines. Opening the file takes > perhaps 4 > seconds as opposed to 1. And unfolding one of the 11,000 line subtrees > for the first time sometimes takes 1-2 seconds. However, once the file > is open and being used, folding and unfolding of blocks is > snappy. Editing and fontification is immediate in the 190 line > blocks. When editing in a 2088 line block, there is an almost 1 second > delay for a fontified character to appear, which is no good at all -- > but I think users of blocks of that size should be happy using C-c > '. I > do not get any fontification messages in the minibuffer. This is on a > slow machine (an Intel atom netbook), with emacs23 and emacs24 running > under linux. > > So even in my 22000 line file containing 190 line blocks, the delays > are > short and only occur when first opening and unfolding the file. > However, > users of very large src blocks should definitely use C-c ' for > editing. > >>>> FWIW, I see the org-src-fontification message while unfolding, > > [...] > >> Could you post that message please (go to *Messages* buffer after >>> unfolding and it should be there). I haven't put any messages in, >>> but I >>> think I know the message you mean and I think it is an Emacs >>> message. > > [...] > >> Yes, here is a portion of the message buffer: >> >> Searching for `makaainana.org'.... >> Automatic display of crossref information was turned on >> Fontifying >> org-src-fontification:latex-mode... >> (regexps.............................) >> Automatic display of crossref information was turned on > > [...] > >> I believe the message comes from line 744 of org-src.el > > No, the message comes from core Emacs fontification code. I'm unsure > why > you are seeing these messages and I am not. > > Do you still see the behaviour/problems you reported above? > > Dan > HI Dan, No, the slowness that I had with this on OS X is gone now. I think the key is this, as Jules Bean noted: #+begin_src emacs-lisp :tangle yes (setq font-lock-verbose nil) #+end_src This was set to 0 previously. Thanks for this improvement. It is great to see semantic markup in code blocks in the Org-mode buffer. Tom >> >> All the best, >> Tom >>>> even >>>> when the unfolded result doesn't show a code block. Later when a >>>> sub- >>>> tree is unfolded, the org-src-fontification message appears again, >>>> which makes me wonder if there is unnecessary work going on. >>>> >>>> All the best, >>>> Tom >>>> >>>> On Sep 9, 2010, at 3:02 AM, Darlan Cavalcante Moreira wrote: >>>> >>>>> >>>>> Thank you Dan, >>>>> >>>>> It is perfect now. No perceivable slowdown >>>>> >>>>> At Wed, 08 Sep 2010 13:41:51 -0400, >>>>> Dan Davison wrote: >>>>>> >>>>>> Darlan Cavalcante Moreira <darcamo@gmail.com> writes: >>>>>> >>>>>>> Maybe my problem is not related to slow folding/unfolding >>>>>>> behavior >>>>>>> that you >>>>>>> are getting, but if I set the org-src-tab-acts-natively variable >>>>>>> to t the >>>>>>> folding/unfolding of headlines becomes very slow for me. >>>>>> >>>>>> Thank you Darlan, >>>>>> >>>>>> I have just pushed a change that should make that better -- does >>>>>> that >>>>>> improve things? >>>>>> >>>>>> I did think there was something else going on (that was why I >>>>>> asked >>>>>> Tom >>>>>> for confirmation), but I didn't have time to investigate >>>>>> properly. The >>>>>> problem seems to be that, on a folded headline containing many >>>>>> blocks, >>>>>> `org-edit-src-find-region-and-lang' is actually quite slow to >>>>>> come up >>>>>> with the answer "No, there's nothing for me to edit here." (try >>>>>> issuing >>>>>> M-x org-edit-src-code on a folded headline containing many >>>>>> blocks; I >>>>>> haven't understood this properly yet.) >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>> >>>>>>> >>>>>>> In fact, I was thinking that I had the problem described here, >>>>>>> but >>>>>>> I just >>>>>>> isolated the cause and in my case it was the org-src-tab-acts- >>>>>>> natively >>>>>>> variable that I had set to t in my .emacs file. >>>>>>> >>>>>>> -- >>>>>>> Darlan >>>>>>> >>>>>>> At Tue, 7 Sep 2010 06:05:54 -1000, >>>>>>> "Thomas S. Dye" <tsd@tsdye.com> wrote: >>>>>>>> >>>>>>>> Hi Dan, >>>>>>>> >>>>>>>> Yes, I can confirm that (setq org-src-fontify-natively nil) >>>>>>>> makes >>>>>>>> unfolding snappy again. >>>>>>>> >>>>>>>> All the best, >>>>>>>> Tom >>>>>>>> >>>>>>>> On Sep 7, 2010, at 3:23 AM, Dan Davison wrote: >>>>>>>> >>>>>>>>> "Thomas S. Dye" <tsd@tsdye.com> writes: >>>>>>>>> >>>>>>>>>> Aloha Dan, >>>>>>>>>> >>>>>>>>>> This is really nice. Thanks for shepherding it along. >>>>>>>>>> >>>>>>>>>> In some of my use cases there is a substantial delay when >>>>>>>>>> opening a >>>>>>>>>> large file and then unfolding sections with many source code >>>>>>>>>> blocks. >>>>>>>>> >>>>>>>>> Hi Tom, >>>>>>>>> >>>>>>>>> I think this is a good point and probably as you say a reason >>>>>>>>> for >>>>>>>>> turning it off by default. Org should be (and was!) >>>>>>>>> lightweight by >>>>>>>>> default. >>>>>>>>> >>>>>>>>> I haven't had time to profile things properly. Before we >>>>>>>>> turn it >>>>>>>>> off, >>>>>>>>> could you please confirm that all your slowness problems go >>>>>>>>> away >>>>>>>>> when >>>>>>>>> you do (setq org-src-fontify-natively nil)? >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> >>>>>>>>> Dan >>>>>>>>> >>>>>>>>> >>>>>>>>>> I don't mind this and intend to keep the feature on, but I do >>>>>>>>>> think >>>>>>>>>> it >>>>>>>>>> should be off by default because the user potentially pays an >>>>>>>>>> appreciable time penalty for the pleasure of semantic source >>>>>>>>>> code >>>>>>>>>> markup. >>>>>>>>>> >>>>>>>>>> Thanks again for this nice feature. >>>>>>>>>> >>>>>>>>>> All the best, >>>>>>>>>> Tom >>>>>>>>>> >>>>>>>>>> On Sep 3, 2010, at 7:30 AM, Eric S Fraga wrote: >>>>>>>>>> >>>>>>>>>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison >>>>>>>>>>> <davison@stats.ox.ac.uk >>>>>>>>>>>> wrote: >>>>>>>>>>>> >>>>>>>>>>>> I've just pushed changes which mean that Org now fontifies >>>>>>>>>>>> code in >>>>>>>>>>>> code >>>>>>>>>>>> blocks. Currently, this is turned on by default, so it >>>>>>>>>>>> would be >>>>>>>>>>>> helpful >>>>>>>>>>>> if people could report any problems, and opinions as to >>>>>>>>>>>> whether it >>>>>>>>>>>> should be on or off by default.< >>>>>>>>>>> >>>>>>>>>>> [...] >>>>>>>>>>> >>>>>>>>>>> This is brilliant! Works very well on my notebook (with >>>>>>>>>>> small >>>>>>>>>>> code >>>>>>>>>>> blocks as that's all I tend to have). Many thanks! >>>>>>>>>>> -- >>>>>>>>>>> Eric S Fraga >>>>>>>>>>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> 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 >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> 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 >>>> >>>> >>>> _______________________________________________ >>>> 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-03 17:30 ` Eric S Fraga 2010-09-03 19:10 ` Thomas S. Dye @ 2010-09-06 16:59 ` Richard Riley 2010-09-06 17:53 ` David O'Toole ` (3 more replies) 1 sibling, 4 replies; 56+ messages in thread From: Richard Riley @ 2010-09-06 16:59 UTC (permalink / raw) To: emacs-orgmode Eric S Fraga <ucecesf@ucl.ac.uk> writes: > On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: >> >> I've just pushed changes which mean that Org now fontifies code in code >> blocks. Currently, this is turned on by default, so it would be helpful >> if people could report any problems, and opinions as to whether it >> should be on or off by default. > > [...] > > This is brilliant! Works very well on my notebook (with small code > blocks as that's all I tend to have). Many thanks! Without wanting to rock the boat I think its safer to have this disabled by default. I cant tell you how many times I thought I was in the LISP buffer and ended up making a mess since this enhancement was added. I realise I can configure it myself but possibly the more conservative "stick with old default" is better? It IS a nice feature when in more capable hands than mine ;) What next? nxhtml integration and live editing inside the src blocks? ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-06 16:59 ` Richard Riley @ 2010-09-06 17:53 ` David O'Toole 2010-09-06 18:30 ` Bastien 2010-09-06 17:59 ` Erik Iverson ` (2 subsequent siblings) 3 siblings, 1 reply; 56+ messages in thread From: David O'Toole @ 2010-09-06 17:53 UTC (permalink / raw) To: Richard Riley; +Cc: emacs-orgmode maybe there could be an on-by-default variable called org-warn-when-editing-src-block-in-org-buffer, or make the text readonly, etc. making this on-by-default would seem to create another discussion about things being on-by-default :) however, if fontification is on by default, then this should also be on by default, since fontification causes the mistaken in-org-buffer edits that Richard points out, which seems reasonable to want to prevent systematically. I've done this myself a few times. On Mon, Sep 6, 2010 at 12:59 PM, Richard Riley <rileyrg@gmail.com> wrote: > Eric S Fraga <ucecesf@ucl.ac.uk> writes: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> [...] >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! > > Without wanting to rock the boat I think its safer to have this disabled > by default. I cant tell you how many times I thought I was in the LISP > buffer and ended up making a mess since this enhancement was added. I > realise I can configure it myself but possibly the more conservative > "stick with old default" is better? It IS a nice feature when in more > capable hands than mine ;) What next? nxhtml integration and live > editing inside the src blocks? > > > > > > _______________________________________________ > 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-06 17:53 ` David O'Toole @ 2010-09-06 18:30 ` Bastien 2010-09-06 18:52 ` David O'Toole 0 siblings, 1 reply; 56+ messages in thread From: Bastien @ 2010-09-06 18:30 UTC (permalink / raw) To: David O'Toole; +Cc: emacs-orgmode, Richard Riley If setting org-src-fontify-natively to `t' by default triggers a debate on whether we need to set org-warn-when-editing-src-block-in-org-buffer on or off by default, I'd rather set org-src-fontify-natively off by default... My 2 cts, -- Bastien ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-06 18:30 ` Bastien @ 2010-09-06 18:52 ` David O'Toole 2010-09-06 18:59 ` Richard Riley 2010-09-07 13:43 ` Dan Davison 0 siblings, 2 replies; 56+ messages in thread From: David O'Toole @ 2010-09-06 18:52 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode, Richard Riley I agree Bastien :) On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: > If setting org-src-fontify-natively to `t' by default triggers a debate > on whether we need to set org-warn-when-editing-src-block-in-org-buffer > on or off by default, I'd rather set org-src-fontify-natively off by > default... > > My 2 cts, > > -- > Bastien > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 18:52 ` David O'Toole @ 2010-09-06 18:59 ` Richard Riley 2010-09-07 13:43 ` Dan Davison 1 sibling, 0 replies; 56+ messages in thread From: Richard Riley @ 2010-09-06 18:59 UTC (permalink / raw) To: emacs-orgmode "David O'Toole" <dto1138@gmail.com> writes: > I agree Bastien :) Possibly a customize interface for it would be nice too if the code is touched! > > On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: >> If setting org-src-fontify-natively to `t' by default triggers a debate >> on whether we need to set org-warn-when-editing-src-block-in-org-buffer >> on or off by default, I'd rather set org-src-fontify-natively off by >> default... >> >> My 2 cts, >> >> -- >> Bastien BTW, can the mail list auto .sig append also prefix it with a "-- /n" so its auto snipped on reply by many newsreaders? >> > > _______________________________________________ > 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 18:52 ` David O'Toole 2010-09-06 18:59 ` Richard Riley @ 2010-09-07 13:43 ` Dan Davison 2010-09-07 14:22 ` Carsten Dominik ` (2 more replies) 1 sibling, 3 replies; 56+ messages in thread From: Dan Davison @ 2010-09-07 13:43 UTC (permalink / raw) To: David O'Toole; +Cc: Richard Riley, emacs-orgmode, Bastien "David O'Toole" <dto1138@gmail.com> writes: > I agree Bastien :) I agree too, but note that what we are agreeing to is a conditional statement... > > On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: >> If setting org-src-fontify-natively to `t' by default triggers a debate >> on whether we need to set org-warn-when-editing-src-block-in-org-buffer I don't think it is clear that there is such a debate. But I do think we are gravitating towards turning it off, if it is causing noticeable slowness on startup. So unless there are more voices in favour of keeping it turned on for new users then I'll turn it off later today. Dan >> on or off by default, I'd rather set org-src-fontify-natively off by >> default... >> >> My 2 cts, >> >> -- >> Bastien >> > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 13:43 ` Dan Davison @ 2010-09-07 14:22 ` Carsten Dominik 2010-09-07 14:33 ` Bastien 2010-09-07 16:54 ` Dan Davison 2010-09-07 14:24 ` Bastien 2010-09-07 14:33 ` Tom Short 2 siblings, 2 replies; 56+ messages in thread From: Carsten Dominik @ 2010-09-07 14:22 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode, Richard Riley, Bastien On Tue, Sep 7, 2010 at 3:43 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: > "David O'Toole" <dto1138@gmail.com> writes: > >> I agree Bastien :) > > I agree too, but note that what we are agreeing to is a conditional > statement... > >> >> On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: >>> If setting org-src-fontify-natively to `t' by default triggers a debate >>> on whether we need to set org-warn-when-editing-src-block-in-org-buffer > > I don't think it is clear that there is such a debate. > > But I do think we are gravitating towards turning it off, if it is > causing noticeable slowness on startup. So unless there are more voices > in favour of keeping it turned on for new users then I'll turn it off > later today. Just to add to this: After trying it more, I see another reason why it would be good to have it turned off by default. Fontification gives meaning to pieces of text, and that meaning is different in different major modes. So this is watering down the meaning of org-mode syntax font locking. So it is good for experts, but confusing for newbies. So my vote goes to off. I *do* like the idea mentioned earlier to use a different background when fontification is turned on. Just a slight grey instead of white, for example. That would help distinguish things in export mode. - Carsten ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 14:22 ` Carsten Dominik @ 2010-09-07 14:33 ` Bastien 2010-09-07 14:37 ` Carsten Dominik ` (2 more replies) 2010-09-07 16:54 ` Dan Davison 1 sibling, 3 replies; 56+ messages in thread From: Bastien @ 2010-09-07 14:33 UTC (permalink / raw) To: Carsten Dominik; +Cc: Dan Davison, Richard Riley, emacs-orgmode Carsten Dominik <carsten.dominik@gmail.com> writes: > I *do* like the idea mentioned earlier to use a different background > when fontification is turned on. Just a slight grey instead of white, > for example. That would help distinguish things in export mode. +1 Or maybe a different font? People might want to use an Inconsolata-link font for normal text, and a Terminal-like font for code excerpts. -- Bastien ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 14:33 ` Bastien @ 2010-09-07 14:37 ` Carsten Dominik 2010-09-07 14:41 ` Sebastian Rose 2010-09-07 15:03 ` Sébastien Vauban 2 siblings, 0 replies; 56+ messages in thread From: Carsten Dominik @ 2010-09-07 14:37 UTC (permalink / raw) To: Bastien; +Cc: Dan Davison, emacs-orgmode, Richard Riley On Tue, Sep 7, 2010 at 4:33 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: > Carsten Dominik <carsten.dominik@gmail.com> writes: > >> I *do* like the idea mentioned earlier to use a different background >> when fontification is turned on. Just a slight grey instead of white, >> for example. That would help distinguish things in export mode. I mean EXPERT mode :) ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 14:33 ` Bastien 2010-09-07 14:37 ` Carsten Dominik @ 2010-09-07 14:41 ` Sebastian Rose 2010-09-07 16:20 ` Dan Davison 2010-09-07 15:03 ` Sébastien Vauban 2 siblings, 1 reply; 56+ messages in thread From: Sebastian Rose @ 2010-09-07 14:41 UTC (permalink / raw) To: Bastien; +Cc: Dan Davison, emacs-orgmode, Richard Riley, Carsten Dominik Bastien <bastien.guerry@wikimedia.fr> writes: > Carsten Dominik <carsten.dominik@gmail.com> writes: > >> I *do* like the idea mentioned earlier to use a different background >> when fontification is turned on. Just a slight grey instead of white, >> for example. That would help distinguish things in export mode. > > +1 +2 > Or maybe a different font? Since some month I have blue color for such blocks. I simply use `org-block' face for this. C-c ' is so easy to hit. > People might want to use an Inconsolata-link font for normal text, > and a Terminal-like font for code excerpts. I'll google "Inconsolata-link font" now... ;) Sebastian ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 14:41 ` Sebastian Rose @ 2010-09-07 16:20 ` Dan Davison 0 siblings, 0 replies; 56+ messages in thread From: Dan Davison @ 2010-09-07 16:20 UTC (permalink / raw) To: Sebastian Rose; +Cc: Richard Riley, Carsten Dominik, emacs-orgmode, Bastien Sebastian Rose <sebastian_rose@gmx.de> writes: > Bastien <bastien.guerry@wikimedia.fr> writes: > >> Carsten Dominik <carsten.dominik@gmail.com> writes: >> >>> I *do* like the idea mentioned earlier to use a different background >>> when fontification is turned on. Just a slight grey instead of white, >>> for example. That would help distinguish things in export mode. >> >> +1 > > +2 One concern is that it can be hard to make things like that work well across different emacs background colors and color-themes, application transparency, etc. > >> Or maybe a different font? > > > Since some month I have blue color for such blocks. > I simply use `org-block' face for this. > > C-c ' > > is so easy to hit. > > >> People might want to use an Inconsolata-link font for normal text, >> and a Terminal-like font for code excerpts. > > I'll google "Inconsolata-link font" now... ;) > > > Sebastian > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 14:33 ` Bastien 2010-09-07 14:37 ` Carsten Dominik 2010-09-07 14:41 ` Sebastian Rose @ 2010-09-07 15:03 ` Sébastien Vauban 2 siblings, 0 replies; 56+ messages in thread From: Sébastien Vauban @ 2010-09-07 15:03 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Carsten, Bastien and the rest, Bastien wrote: > Carsten Dominik <carsten.dominik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > >> I *do* like the idea mentioned earlier to use a different background >> when fontification is turned on. Just a slight grey instead of white, >> for example. That would help distinguish things in export mode. Thanks Carsten! ;-) > +1 > > Or maybe a different font? > > People might want to use an Inconsolata-link font for normal text, and a > Terminal-like font for code excerpts. Personally, I don't like another font, as I use Consolas for *everything* under Emacs. Best, of course, is to allow one to choose following his preferences. In my case, I go for background color... Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 14:22 ` Carsten Dominik 2010-09-07 14:33 ` Bastien @ 2010-09-07 16:54 ` Dan Davison 2010-09-08 16:30 ` Bastien 1 sibling, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-07 16:54 UTC (permalink / raw) To: Carsten Dominik; +Cc: Richard Riley, emacs-orgmode, Bastien Carsten Dominik <carsten.dominik@gmail.com> writes: > On Tue, Sep 7, 2010 at 3:43 PM, Dan Davison <davison@stats.ox.ac.uk> wrote: >> "David O'Toole" <dto1138@gmail.com> writes: >> >>> I agree Bastien :) >> >> I agree too, but note that what we are agreeing to is a conditional >> statement... >> >>> >>> On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: >>>> If setting org-src-fontify-natively to `t' by default triggers a debate >>>> on whether we need to set org-warn-when-editing-src-block-in-org-buffer >> >> I don't think it is clear that there is such a debate. >> >> But I do think we are gravitating towards turning it off, if it is >> causing noticeable slowness on startup. So unless there are more voices >> in favour of keeping it turned on for new users then I'll turn it off >> later today. > > Just to add to this: After trying it more, I see another reason why > it would be good > to have it turned off by default. Fontification gives meaning to pieces > of text, and that meaning is different in different major modes. So > this is watering > down the meaning of org-mode syntax font locking. So it is good for experts, > but confusing for newbies. So my vote goes to off. OK, this is now off by default. And it's added to customize under the "Org Appearance" and "Babel" groups. (We badly need a customize group for these org-src but non-babel variables[1]. That suggests to me subsuming the "Babel" group (Should be "Org Babel" for consistency?) within a new group, perhaps "Org Code" or "Org Src" or "Org Source Code" ? Views? > > I *do* like the idea mentioned earlier to use a different background > when fontification is turned on. Just a slight grey instead of white, > for example. That would help distinguish things in export mode. I haven't addressed this. Dan > > - Carsten > > _______________________________________________ > 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 Footnotes: [1] E.g. Org Src Lang Modes is within Org Edit Structure which is within Org Structure, which is deeply obscure! ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 16:54 ` Dan Davison @ 2010-09-08 16:30 ` Bastien 2010-09-08 18:35 ` Sébastien Vauban 0 siblings, 1 reply; 56+ messages in thread From: Bastien @ 2010-09-08 16:30 UTC (permalink / raw) To: Dan Davison; +Cc: Richard Riley, emacs-orgmode, Carsten Dominik Dan Davison <davison@stats.ox.ac.uk> writes: > (We badly need a customize group for these org-src but non-babel > variables[1]. That suggests to me subsuming the "Babel" group (Should be > "Org Babel" for consistency?) within a new group, perhaps "Org Code" or > "Org Src" or "Org Source Code" ? Views? I find "Org Code" and "Org Source Code" rather ambiguous. "Org Src" is better but still a bit too general IMHO. "Org Src Block"? -- Bastien ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-08 16:30 ` Bastien @ 2010-09-08 18:35 ` Sébastien Vauban 2010-09-08 18:42 ` Erik Iverson 0 siblings, 1 reply; 56+ messages in thread From: Sébastien Vauban @ 2010-09-08 18:35 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Bastien and Dan, Bastien wrote: > Dan Davison <davison-+7o2aNKnwVPQzY9nttDBhA@public.gmane.org> writes: > >> (We badly need a customize group for these org-src but non-babel >> variables[1]. That suggests to me subsuming the "Babel" group (Should be >> "Org Babel" for consistency?) within a new group, perhaps "Org Code" or >> "Org Src" or "Org Source Code" ? Views? > > I find "Org Code" and "Org Source Code" rather ambiguous. "Org Src" is > better but still a bit too general IMHO. > > "Org Src Block"? The terminology of such code blocks in Noweb was "scraps". We often see "snippets" as well, but (not being English-native), that can be more for pure text (not specifically code). Then, it could be "Org Scraps" or similar variants. To be honest, I don't really care, as I never use customize. It's true that I've always found it difficult to find where the variables I was searching for were located... Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-08 18:35 ` Sébastien Vauban @ 2010-09-08 18:42 ` Erik Iverson 2010-09-08 19:17 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Erik Iverson @ 2010-09-08 18:42 UTC (permalink / raw) To: Sébastien Vauban; +Cc: emacs-orgmode Sébastien Vauban wrote: > Hi Bastien and Dan, > > Bastien wrote: >> Dan Davison <davison@stats.ox.ac.uk> writes: >> >>> (We badly need a customize group for these org-src but non-babel >>> variables[1]. That suggests to me subsuming the "Babel" group (Should be >>> "Org Babel" for consistency?) within a new group, perhaps "Org Code" or >>> "Org Src" or "Org Source Code" ? Views? >> I find "Org Code" and "Org Source Code" rather ambiguous. "Org Src" is >> better but still a bit too general IMHO. >> >> "Org Src Block"? > > The terminology of such code blocks in Noweb was "scraps". We often see > "snippets" as well, but (not being English-native), that can be more for pure > text (not specifically code). > > Then, it could be "Org Scraps" or similar variants. Or "chunk", which I subjectively find the most phonetically pleasing. ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-08 18:42 ` Erik Iverson @ 2010-09-08 19:17 ` Dan Davison 0 siblings, 0 replies; 56+ messages in thread From: Dan Davison @ 2010-09-08 19:17 UTC (permalink / raw) To: Erik Iverson; +Cc: Sébastien Vauban, emacs-orgmode Erik Iverson <eriki@ccbr.umn.edu> writes: > Sébastien Vauban wrote: >> Hi Bastien and Dan, >> >> Bastien wrote: >>> Dan Davison <davison@stats.ox.ac.uk> writes: >>> >>>> (We badly need a customize group for these org-src but non-babel >>>> variables[1]. That suggests to me subsuming the "Babel" group (Should be >>>> "Org Babel" for consistency?) within a new group, perhaps "Org Code" or >>>> "Org Src" or "Org Source Code" ? Views? >>> I find "Org Code" and "Org Source Code" rather ambiguous. Yes, you're right! >>> "Org Src" is >>> better but still a bit too general IMHO. >>> >>> "Org Src Block"? I do sometimes find myself wondering whether "src" is a little cryptic for user-level documentation: an alternative would be "code" as in "code blocks". But src is hard-wired into "begin_src", and it is familiar to many programmers, and it is already traditional in Org-mode, so perhaps it is fine. >> The terminology of such code blocks in Noweb was "scraps". We often see >> "snippets" as well, but (not being English-native), that can be more for pure >> text (not specifically code). >> >> Then, it could be "Org Scraps" or similar variants. > > Or "chunk", which I subjectively find the most phonetically pleasing. I would like there to be some uniformity in this, across documentation, docstrings and function and variable names. I have been guilty of using "code blocks" in docstrings and commit logs. So if "src block" is /the/ Org-mode way of referring to these things, then let's stick to it! For the purposes of customize, we don't have to abbreviate, so we could also have "Org Source Code Blocks" but as Bastien sugests, "Org Src Blocks" would be a natural Org-mode term. 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-07 13:43 ` Dan Davison 2010-09-07 14:22 ` Carsten Dominik @ 2010-09-07 14:24 ` Bastien 2010-09-07 14:33 ` Tom Short 2 siblings, 0 replies; 56+ messages in thread From: Bastien @ 2010-09-07 14:24 UTC (permalink / raw) To: Dan Davison; +Cc: Richard Riley, emacs-orgmode Dan Davison <davison@stats.ox.ac.uk> writes: > But I do think we are gravitating towards turning it off, if it is > causing noticeable slowness on startup. So unless there are more voices > in favour of keeping it turned on for new users then I'll turn it off > later today. I didn't test turning it on and off long enough to have a strong opinion on this issue. In both cases, let's document this variable very clearly in the manual and have a FAQ entry on Worg. Thanks, -- Bastien ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 13:43 ` Dan Davison 2010-09-07 14:22 ` Carsten Dominik 2010-09-07 14:24 ` Bastien @ 2010-09-07 14:33 ` Tom Short 2010-09-07 14:47 ` Richard Riley 2 siblings, 1 reply; 56+ messages in thread From: Tom Short @ 2010-09-07 14:33 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode, Richard Riley, Bastien I think it'd help for new users to keep it on by default, but since it can be changed, I'm fine either way. How hard would it be to use a property, so it could be changed on a per-file basis? If it's difficult, that time may be better spent profiling and speeding it up. - Tom On Tue, Sep 7, 2010 at 9:43 AM, Dan Davison <davison@stats.ox.ac.uk> wrote: > "David O'Toole" <dto1138@gmail.com> writes: > >> I agree Bastien :) > > I agree too, but note that what we are agreeing to is a conditional > statement... > >> >> On Mon, Sep 6, 2010 at 2:30 PM, Bastien <bastien.guerry@wikimedia.fr> wrote: >>> If setting org-src-fontify-natively to `t' by default triggers a debate >>> on whether we need to set org-warn-when-editing-src-block-in-org-buffer > > I don't think it is clear that there is such a debate. > > But I do think we are gravitating towards turning it off, if it is > causing noticeable slowness on startup. So unless there are more voices > in favour of keeping it turned on for new users then I'll turn it off > later today. > > Dan > > >>> on or off by default, I'd rather set org-src-fontify-natively off by >>> default... >>> >>> My 2 cts, >>> >>> -- >>> Bastien >>> >> >> _______________________________________________ >> 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 > ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-07 14:33 ` Tom Short @ 2010-09-07 14:47 ` Richard Riley 0 siblings, 0 replies; 56+ messages in thread From: Richard Riley @ 2010-09-07 14:47 UTC (permalink / raw) To: Tom Short; +Cc: emacs-orgmode Tom Short <tshort.rlists@gmail.com> writes: > I think it'd help for new users to keep it on by default, but since it > can be changed, I'm fine either way. How hard would it be to use a > property, so it could be changed on a per-file basis? If it's > difficult, that time may be better spent profiling and speeding it up. > > - Tom I think its exactly the opposite : its more dangerous having it on for new users. The reason is the confusion as to what mode you're in (I'm not a new user and I keep tripping up on that as my src blocks are pretty big) and the potential slow up which others have noticed. Maybe the first time you open an org file in a window and it detects src blocks it can even prompt and accept the customised setting there and then and store it. Its a major enough feature to warrant that perhaps? get-buffer-window can be used to determine if its being edited. ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Re: Org now fontifies code blocks 2010-09-06 16:59 ` Richard Riley 2010-09-06 17:53 ` David O'Toole @ 2010-09-06 17:59 ` Erik Iverson 2010-09-06 18:23 ` Dan Davison 2010-09-07 7:24 ` Sébastien Vauban 3 siblings, 0 replies; 56+ messages in thread From: Erik Iverson @ 2010-09-06 17:59 UTC (permalink / raw) To: Richard Riley; +Cc: emacs-orgmode On 09/06/2010 11:59 AM, Richard Riley wrote: > Eric S Fraga<ucecesf@ucl.ac.uk> writes: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison<davison@stats.ox.ac.uk> wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> [...] >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! > > Without wanting to rock the boat I think its safer to have this disabled > by default. I cant tell you how many times I thought I was in the LISP > buffer and ended up making a mess since this enhancement was added. I > realise I can configure it myself but possibly the more conservative > "stick with old default" is better? It IS a nice feature when in more > capable hands than mine ;) What next? nxhtml integration and live > editing inside the src blocks? I think several people have that setup already. Last I heard a few days ago, there was an issue with editing R that was being resolved. > > > > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 16:59 ` Richard Riley 2010-09-06 17:53 ` David O'Toole 2010-09-06 17:59 ` Erik Iverson @ 2010-09-06 18:23 ` Dan Davison 2010-09-06 18:49 ` Richard Riley 2010-09-07 7:24 ` Sébastien Vauban 3 siblings, 1 reply; 56+ messages in thread From: Dan Davison @ 2010-09-06 18:23 UTC (permalink / raw) To: Richard Riley; +Cc: emacs-orgmode Richard Riley <rileyrg@gmail.com> writes: > Eric S Fraga <ucecesf@ucl.ac.uk> writes: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> [...] >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! > > Without wanting to rock the boat I think its safer to have this disabled > by default. I cant tell you how many times I thought I was in the LISP > buffer and ended up making a mess since this enhancement was added. Hi Richard, I'm not quite clear what problems are arising from Org buffer edits. Could you expand? Thanks, Dan > I realise I can configure it myself but possibly the more conservative > "stick with old default" is better? It IS a nice feature when in more > capable hands than mine ;) What next? nxhtml integration and live > editing inside the src blocks? > > > > > > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 18:23 ` Dan Davison @ 2010-09-06 18:49 ` Richard Riley 2010-09-07 13:33 ` Dan Davison 0 siblings, 1 reply; 56+ messages in thread From: Richard Riley @ 2010-09-06 18:49 UTC (permalink / raw) To: Dan Davison; +Cc: emacs-orgmode Dan Davison <davison@stats.ox.ac.uk> writes: > Richard Riley <rileyrg@gmail.com> writes: > >> Eric S Fraga <ucecesf@ucl.ac.uk> writes: >> >>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: >>>> >>>> I've just pushed changes which mean that Org now fontifies code in code >>>> blocks. Currently, this is turned on by default, so it would be helpful >>>> if people could report any problems, and opinions as to whether it >>>> should be on or off by default. >>> >>> [...] >>> >>> This is brilliant! Works very well on my notebook (with small code >>> blocks as that's all I tend to have). Many thanks! >> >> Without wanting to rock the boat I think its safer to have this disabled >> by default. I cant tell you how many times I thought I was in the LISP >> buffer and ended up making a mess since this enhancement was added. > > Hi Richard, > > I'm not quite clear what problems are arising from Org buffer > edits. Could you expand? Nothing particularly harsh but I find myself reaching for elisp hot keys and expecting indentation etc to work. It's no big deal and as I said I can config it to revert to the old behaviour. Probably best to forget my suggestion of leaving the default as no fontification ;) -- ☘ http://www.shamrockirishbar.com, http://www.richardriley.net "Learning French is trivial: the word for horse is 'cheval' and everything follows thusly." ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 18:49 ` Richard Riley @ 2010-09-07 13:33 ` Dan Davison 0 siblings, 0 replies; 56+ messages in thread From: Dan Davison @ 2010-09-07 13:33 UTC (permalink / raw) To: Richard Riley; +Cc: emacs-orgmode Richard Riley <rileyrg@googlemail.com> writes: > Dan Davison <davison@stats.ox.ac.uk> writes: > >> Richard Riley <rileyrg@gmail.com> writes: >> >>> Eric S Fraga <ucecesf@ucl.ac.uk> writes: >>> >>>> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison@stats.ox.ac.uk> wrote: >>>>> >>>>> I've just pushed changes which mean that Org now fontifies code in code >>>>> blocks. Currently, this is turned on by default, so it would be helpful >>>>> if people could report any problems, and opinions as to whether it >>>>> should be on or off by default. >>>> >>>> [...] >>>> >>>> This is brilliant! Works very well on my notebook (with small code >>>> blocks as that's all I tend to have). Many thanks! >>> >>> Without wanting to rock the boat I think its safer to have this disabled >>> by default. I cant tell you how many times I thought I was in the LISP >>> buffer and ended up making a mess since this enhancement was added. I agree it's not obvious what the default should be. The main motivation for me to defaulting to "on" is simply for new users to see code fragments look pretty. >> >> Hi Richard, >> >> I'm not quite clear what problems are arising from Org buffer >> edits. Could you expand? > > Nothing particularly harsh but I find myself reaching for elisp hot > keys Right, but that sort of user is the one who will prob know how to turn it off. I'm more struck by Tom's point that it can be slow with large/many code blocks. > and expecting indentation etc to work. This isn't directly relevant to the fontification default question, but seeing as you mention this, I'll note that indentation in the Org buffer is going to work fairly well: first turn on org-src-tab-acts-natively, and second, assuming my pending patches are accepted, indent-region will work with C-c C-v C-x C-M-\ or to simplify that key sequence, you will be able to bind functions like this to a key (defun dan/org-comment-dwim (&optional arg) (interactive "P") (or (org-babel-do-key-sequence-in-edit-buffer "\M-;") (comment-dwim arg))) Dan > It's no big deal and as I said I > can config it to revert to the old behaviour. Probably best to forget my > suggestion of leaving the default as no fontification ;) ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: Org now fontifies code blocks 2010-09-06 16:59 ` Richard Riley ` (2 preceding siblings ...) 2010-09-06 18:23 ` Dan Davison @ 2010-09-07 7:24 ` Sébastien Vauban 3 siblings, 0 replies; 56+ messages in thread From: Sébastien Vauban @ 2010-09-07 7:24 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi all, Richard Riley wrote: > Eric S Fraga <ucecesf-hclig2XLE9Zaa/9Udqfwiw@public.gmane.org> writes: > >> On Thu, 02 Sep 2010 08:51:16 -0700, Dan Davison <davison-+7o2aNKnwVPQzY9nttDBhA@public.gmane.org> wrote: >>> >>> I've just pushed changes which mean that Org now fontifies code in code >>> blocks. Currently, this is turned on by default, so it would be helpful >>> if people could report any problems, and opinions as to whether it >>> should be on or off by default. >> >> This is brilliant! Works very well on my notebook (with small code >> blocks as that's all I tend to have). Many thanks! > > Without wanting to rock the boat I think its safer to have this disabled by > default. I cant tell you how many times I thought I was in the LISP buffer > and ended up making a mess since this enhancement was added. Would it be feasible to get a colored background (light green, for example) for the code blocks inside Org buffers? Of course, I mean: made to work with language fontification... If yes, we would reach two goals with one stone: 1. Avoid Richard's problem 2. Clearly identify codes inlined in text, by making them standing out. Thanks for your reactions on this... Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH] Mode-specific fontification of babel source blocks 2010-08-03 23:12 [PATCH] Mode-specific fontification of babel source blocks David O'Toole 2010-08-03 23:14 ` David O'Toole 2010-08-04 2:55 ` Dan Davison @ 2010-08-15 6:33 ` Dan Davison 2 siblings, 0 replies; 56+ messages in thread From: Dan Davison @ 2010-08-15 6:33 UTC (permalink / raw) To: David O'Toole; +Cc: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 1706 bytes --] "David O'Toole" <dto1138@gmail.com> writes: > I've got a preliminary patch that adds optional "native" fontification > for source blocks. It uses the block's declared mode to fontify the > block text. So now blocks look the way they should, and this opens the > way to further enhancements. I've tested David's patch, and made some additions. It's really nice to have fontified code in the Org buffer. It's not that smooth when editing code in the Org buffer, but there seems to be no easy way round that (happy to be proved wrong). In the continued absence of an alternative, I think we should consider adding this. I've prepared a patch which does the following: - David's original patch - Extend regexp to match full Org code src block syntax - I've moved the fontification code out into a separate function - I've provided a standalone manual fontification function `org-src-fontify-block'. On my system, I have not managed to eliminate some point movement during fontification. This occurs because of the heavy-duty method of fontification (delete the code, re-insert fontified code generated in a separate buffer). On the other hand, Org users are not really encouraged to *edit* code in the Org buffer, and the slightly clunky fontification is only experienced by those who go against that. David's variable `org-src-fontify-natively' determines whether font-lock automatically fontifies code blocks. Even if that variable is nil, it is still possible to call `org-src-fontify-block' for manual fontification. Buffer movement is especially problematic with org-indent-mode. Patch against master attached, and also in branch org-src-fontification at git@github.com:dandavison/org-devel.git. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: src-block-fontification.diff --] [-- Type: text/x-diff, Size: 3755 bytes --] diff --git a/lisp/org-src.el b/lisp/org-src.el index baa2b11..3198439 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -654,6 +654,43 @@ the language, a switch telling if the content should be in a single line." (org-add-hook 'org-src-mode-hook 'org-src-mode-configure-edit-buffer) +(defun org-src-font-lock-fontify-block (lang start end) + (let* ((lang-mode (org-src-get-lang-mode lang)) + (string (buffer-substring-no-properties start end)) + (modified (buffer-modified-p)) + (fontified-output + (with-temp-buffer + (insert string) + (funcall lang-mode) + (font-lock-fontify-buffer) + (add-text-properties + (point-min) (point-max) + '(font-lock-fontified t fontified t font-lock-multiline t)) + (buffer-substring (point-min) (point-max))))) + (when fontified-output + (goto-char start) + (delete-region start end) + (insert fontified-output) + (set-buffer-modified-p modified))) + t) ;; Tell `org-fontify-meta-lines-and-blocks' that we fontified + +(defun org-src-fontify-block () + "Fontify code block at point" + (interactive) + (let ((org-src-fontify-natively t) + (info (org-edit-src-find-region-and-lang)) + (point (point))) + (font-lock-fontify-region (nth 0 info) (nth 1 info)) + (goto-char point))) + +(defun org-src-get-lang-mode (lang) + "Return major mode that should be used for LANG. +LANG is a string, and the returned major mode is a symbol." + (intern + (concat + ((lambda (l) (if (symbolp l) (symbol-name l) l)) + (or (cdr (assoc lang org-src-lang-modes)) lang)) "-mode"))) + (provide 'org-src) ;; arch-tag: 6a1fc84f-dec7-47be-a416-64be56bea5d8 diff --git a/lisp/org.el b/lisp/org.el index a05f2bf..b381ad0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5017,17 +5017,23 @@ will be prompted for." '(display t invisible t intangible t)) t))) +(defvar org-src-fontify-natively nil + "When non-nil, fontify source blocks like their major mode would.") + (defun org-fontify-meta-lines-and-blocks (limit) "Fontify #+ lines and blocks, in the correct ways." (let ((case-fold-search t)) (if (re-search-forward - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\(\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)\\)" limit t) - (let ((beg (match-beginning 0)) - (beg1 (line-beginning-position 2)) - (dc1 (downcase (match-string 2))) - (dc3 (downcase (match-string 3))) - end end1 quoting block-type) + (let* ((beg (match-beginning 0)) + (block-start (match-end 0)) + (block-end nil) + (lang (match-string 7)) + (beg1 (line-beginning-position 2)) + (dc1 (downcase (match-string 2))) + (dc3 (downcase (match-string 3))) + end end1 quoting block-type) (cond ((member dc1 '("html:" "ascii:" "latex:" "docbook:")) ;; a single line of backend-specific content @@ -5047,6 +5053,7 @@ will be prompted for." (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") nil t) ;; on purpose, we look further than LIMIT (setq end (match-end 0) end1 (1- (match-beginning 0))) + (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end '(display t invisible t intangible t))) @@ -5056,6 +5063,8 @@ will be prompted for." (add-text-properties beg beg1 '(face org-meta-line)) (add-text-properties end1 end '(face org-meta-line)) (cond + ((and lang org-src-fontify-natively) + (org-src-font-lock-fontify-block lang block-start block-end)) (quoting (add-text-properties beg1 end1 '(face org-block))) ((not org-fontify-quote-and-verse-blocks)) [-- Attachment #3: Type: text/plain, Size: 276 bytes --] Dan > Anyone up for an icons theme standard > discussion? > > _______________________________________________ > 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 [-- Attachment #4: Type: text/plain, Size: 201 bytes --] _______________________________________________ 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 ^ permalink raw reply related [flat|nested] 56+ messages in thread
end of thread, other threads:[~2010-10-28 16:25 UTC | newest] Thread overview: 56+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-03 23:12 [PATCH] Mode-specific fontification of babel source blocks David O'Toole 2010-08-03 23:14 ` David O'Toole 2010-08-03 23:23 ` Erik Iverson 2010-08-04 2:55 ` Dan Davison 2010-08-04 5:55 ` David O'Toole 2010-08-09 21:35 ` Dan Davison 2010-09-02 15:51 ` Org now fontifies code blocks Dan Davison 2010-09-02 17:04 ` Erik Iverson 2010-09-02 19:06 ` Native TAB in code blocks [WAS Re: Org now fontifies code blocks] Dan Davison 2010-09-02 19:18 ` Carsten Dominik 2010-09-02 20:36 ` Native TAB in code blocks Dan Davison 2010-09-03 8:11 ` Julien Fantin 2010-09-02 20:26 ` Org now fontifies " Sébastien Vauban 2010-09-03 17:30 ` Eric S Fraga 2010-09-03 19:10 ` Thomas S. Dye 2010-09-06 16:49 ` David O'Toole 2010-09-07 13:23 ` Dan Davison 2010-09-07 13:55 ` Richard Riley 2010-09-07 16:05 ` Thomas S. Dye 2010-09-08 16:36 ` Darlan Cavalcante Moreira 2010-09-08 17:41 ` Dan Davison 2010-09-09 13:02 ` Darlan Cavalcante Moreira 2010-09-09 21:40 ` Thomas S. Dye 2010-09-09 22:35 ` Dan Davison 2010-09-09 23:03 ` Thomas S. Dye 2010-10-28 11:10 ` Dan Davison 2010-10-28 12:08 ` Jules Bean 2010-10-28 12:47 ` Jambunathan K 2010-10-28 13:35 ` Dan Davison 2010-10-28 16:24 ` Thomas S. Dye 2010-09-06 16:59 ` Richard Riley 2010-09-06 17:53 ` David O'Toole 2010-09-06 18:30 ` Bastien 2010-09-06 18:52 ` David O'Toole 2010-09-06 18:59 ` Richard Riley 2010-09-07 13:43 ` Dan Davison 2010-09-07 14:22 ` Carsten Dominik 2010-09-07 14:33 ` Bastien 2010-09-07 14:37 ` Carsten Dominik 2010-09-07 14:41 ` Sebastian Rose 2010-09-07 16:20 ` Dan Davison 2010-09-07 15:03 ` Sébastien Vauban 2010-09-07 16:54 ` Dan Davison 2010-09-08 16:30 ` Bastien 2010-09-08 18:35 ` Sébastien Vauban 2010-09-08 18:42 ` Erik Iverson 2010-09-08 19:17 ` Dan Davison 2010-09-07 14:24 ` Bastien 2010-09-07 14:33 ` Tom Short 2010-09-07 14:47 ` Richard Riley 2010-09-06 17:59 ` Erik Iverson 2010-09-06 18:23 ` Dan Davison 2010-09-06 18:49 ` Richard Riley 2010-09-07 13:33 ` Dan Davison 2010-09-07 7:24 ` Sébastien Vauban 2010-08-15 6:33 ` [PATCH] Mode-specific fontification of babel source blocks Dan Davison
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).