emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-capitalize-example-region-markers
@ 2017-01-25  2:17 Vicente Vera
  2017-01-25  3:25 ` org-babel-capitalize-example-region-markers Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Vicente Vera @ 2017-01-25  2:17 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello.

Just noticed that example block headings wrapping code evaluation
results appear downcased (arrows added):

#+RESULTS:
#+begin_example <=
... some result...
#+end_example   <=

In ob-core.el, line 2438 there's a "hidden" variable that controls
wether the headings appear upcased:
‘org-babel-capitalize-example-region-markers’. Setting it to non-nil
seems to solve the "problem".

Shouldn't this variable be public through the customize interface?

Also, it seems "capitalize" is the wrong verb here?

[-- Attachment #2: Type: text/html, Size: 639 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-babel-capitalize-example-region-markers
  2017-01-25  2:17 org-babel-capitalize-example-region-markers Vicente Vera
@ 2017-01-25  3:25 ` Kyle Meyer
  2017-01-25  5:17   ` org-babel-capitalize-example-region-markers Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2017-01-25  3:25 UTC (permalink / raw)
  To: Vicente Vera; +Cc: emacs-orgmode

Vicente Vera <vicentemvp@gmail.com> writes:

> Hello.
>
> Just noticed that example block headings wrapping code evaluation
> results appear downcased (arrows added):
>
> #+RESULTS:
>
> #+begin_example <=
> ... some result...
> #+end_example   <=
>
> In ob-core.el, line 2438 there's a "hidden" variable that controls
> wether the headings appear upcased:
> ‘org-babel-capitalize-example-region-markers’. Setting it to non-nil
> seems to solve the "problem".
>
> Shouldn't this variable be public through the customize interface?

Yes, I think it should be.  And it would be consistent with
org-babel-results-keyword being a defcustom.

I don't see a reason for making it a defvar given in f64a859db (force
cap of auto-inserted begin/end example block, 2012-05-21), the commit
that introduced the variable [1], or in the post [2] that resulted in
the addition.

> Also, it seems "capitalize" is the wrong verb here?

Something with "upcase" or "uppercase" would have been better given the
behavior of upcase and capitalize.


[1] Originally named org-babel-capitalize-examplize-region-markers
[2] https://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00607.html

-- 
Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-babel-capitalize-example-region-markers
  2017-01-25  3:25 ` org-babel-capitalize-example-region-markers Kyle Meyer
@ 2017-01-25  5:17   ` Kyle Meyer
  2017-01-27  1:12     ` org-babel-capitalize-example-region-markers Kyle Meyer
  2017-02-26 20:20     ` org-babel-capitalize-example-region-markers Sebastien Vauban
  0 siblings, 2 replies; 6+ messages in thread
From: Kyle Meyer @ 2017-01-25  5:17 UTC (permalink / raw)
  To: Vicente Vera; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

[...]

>> Shouldn't this variable be public through the customize interface?
>
> Yes, I think it should be.  And it would be consistent with
> org-babel-results-keyword being a defcustom.

[...]

>> Also, it seems "capitalize" is the wrong verb here?
>
> Something with "upcase" or "uppercase" would have been better given the
> behavior of upcase and capitalize.

Here's a patch.  I'll apply it to master in a day or two if there are no
objections.

-- >8 --
Subject: [PATCH] ob-core: Add org-babel-uppercase-example-markers option

* lisp/ob-core.el (org-babel-capitalize-example-region-markers): Mark
as obsolete.
(org-babel-uppercase-example-markers): New defcustom to replace defvar
org-babel-capitalize-example-region-markers.
(org-babel-examplify-region): Use new option.

Rather than moving org-babel-capitalize-example-region-markers to a
defcustom, give the option a new name that makes it clearer that all
characters, not just the first, will be in upper case.

Suggested-by: Vicente Vera <vicentemvp@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/111656>
---
 etc/ORG-NEWS       |  7 +++++++
 lisp/ob-core.el    | 13 +++++++++----
 lisp/org-compat.el |  3 +++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index fdce28b1d..58875009f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -218,6 +218,13 @@ document with ~org-mark-ring-goto~ (default binding =C-c &=).
 *** ~org-get-heading~ accepts two more optional arguments
 
 See docstring for details.
+
+*** New option ~org-babel-uppercase-example-markers~
+
+This variable is a ~defcustom~ and replaces the variable
+~org-babel-capitalize-example-region-markers~, which is a ~defvar~ and
+is now obselete.
+
 * Version 9.0
 
 ** Incompatible changes
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 663fe18b0..d312f2ceb 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -179,6 +179,14 @@ (defcustom org-babel-hash-show-time nil
   :package-version '(Org . "9.0")
   :safe #'booleanp)
 
+(defcustom org-babel-uppercase-example-markers nil
+  "When non-nil, begin/end example markers will be inserted in upper case."
+  :group 'org-babel
+  :type 'boolean
+  :version "25.2"
+  :package-version '(Org . "9.1")
+  :safe #'booleanp)
+
 (defun org-babel-noweb-wrap (&optional regexp)
   (concat org-babel-noweb-wrap-start
 	  (or regexp "\\([^ \t\n].+?[^ \t]\\|[^ \t\n]\\)")
@@ -2435,15 +2443,12 @@ (defun org-babel-result-to-file (result &optional description)
 	      result)
 	    (if description (concat "[" description "]") ""))))
 
-(defvar org-babel-capitalize-example-region-markers nil
-  "Make true to capitalize begin/end example markers inserted by code blocks.")
-
 (defun org-babel-examplify-region (beg end &optional results-switches inline)
   "Comment out region using the inline `==' or `: ' org example quote."
   (interactive "*r")
   (let ((maybe-cap
 	 (lambda (str)
-	   (if org-babel-capitalize-example-region-markers (upcase str) str))))
+	   (if org-babel-uppercase-example-markers (upcase str) str))))
     (if inline
 	(save-excursion
 	  (goto-char beg)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 152c6e7d5..948bd06fb 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -195,6 +195,9 @@ (define-obsolete-function-alias 'org-agenda-todayp
   'org-agenda-today-p "Org 9.0")
 (define-obsolete-function-alias 'org-babel-examplize-region
   'org-babel-examplify-region "Org 9.0")
+(define-obsolete-variable-alias 'org-babel-capitalize-example-region-markers
+  'org-babel-uppercase-example-markers "Org 9.1")
+
 (define-obsolete-function-alias 'org-babel-trim 'org-trim "Org 9.0")
 (define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4")
 (define-obsolete-function-alias 'org-insert-columns-dblock
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: org-babel-capitalize-example-region-markers
  2017-01-25  5:17   ` org-babel-capitalize-example-region-markers Kyle Meyer
@ 2017-01-27  1:12     ` Kyle Meyer
  2017-01-28  2:50       ` org-babel-capitalize-example-region-markers Vicente Vera
  2017-02-26 20:20     ` org-babel-capitalize-example-region-markers Sebastien Vauban
  1 sibling, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2017-01-27  1:12 UTC (permalink / raw)
  To: Vicente Vera; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

[...]

> Here's a patch.  I'll apply it to master in a day or two if there are no
> objections.

Applied with 9c111f63 (with :version changed from 25.2 to 26.1).

-- 
Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-babel-capitalize-example-region-markers
  2017-01-27  1:12     ` org-babel-capitalize-example-region-markers Kyle Meyer
@ 2017-01-28  2:50       ` Vicente Vera
  0 siblings, 0 replies; 6+ messages in thread
From: Vicente Vera @ 2017-01-28  2:50 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

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

Nice, thank you.

2017-01-27 1:12 GMT+00:00 Kyle Meyer <kyle@kyleam.com>:

> Kyle Meyer <kyle@kyleam.com> writes:
>
> [...]
>
> > Here's a patch.  I'll apply it to master in a day or two if there are no
> > objections.
>
> Applied with 9c111f63 (with :version changed from 25.2 to 26.1).
>
> --
> Kyle
>

[-- Attachment #2: Type: text/html, Size: 792 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-babel-capitalize-example-region-markers
  2017-01-25  5:17   ` org-babel-capitalize-example-region-markers Kyle Meyer
  2017-01-27  1:12     ` org-babel-capitalize-example-region-markers Kyle Meyer
@ 2017-02-26 20:20     ` Sebastien Vauban
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastien Vauban @ 2017-02-26 20:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello all,

Kyle Meyer <kyle-4Wn5G85RAV/QT0dZR+AlfA@public.gmane.org> writes:
> Kyle Meyer <kyle-4Wn5G85RAV/QT0dZR+AlfA@public.gmane.org> writes:
>
> [...]
>
>>> Also, it seems "capitalize" is the wrong verb here?
>>
>> Something with "upcase" or "uppercase" would have been better given the
>> behavior of upcase and capitalize.
>
> Here's a patch.  I'll apply it to master in a day or two if there are no
> objections.

Shouldn't we have an option which would control the case of all
"keywords" found in `org-structure-template-alist' in one go -- and not
just the "example" template?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-26 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-25  2:17 org-babel-capitalize-example-region-markers Vicente Vera
2017-01-25  3:25 ` org-babel-capitalize-example-region-markers Kyle Meyer
2017-01-25  5:17   ` org-babel-capitalize-example-region-markers Kyle Meyer
2017-01-27  1:12     ` org-babel-capitalize-example-region-markers Kyle Meyer
2017-01-28  2:50       ` org-babel-capitalize-example-region-markers Vicente Vera
2017-02-26 20:20     ` org-babel-capitalize-example-region-markers Sebastien Vauban

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).