* Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)]
@ 2017-07-06 6:12 Tobias Zawada
2017-07-06 7:03 ` Rasmus
2017-08-28 8:12 ` Nicolas Goaziou
0 siblings, 2 replies; 4+ messages in thread
From: Tobias Zawada @ 2017-07-06 6:12 UTC (permalink / raw)
To: emacs-orgmode
At first I would like to ask whether it is already possible to change
the default settings of the source block header line switches.
The question
> Is it possible to define source block switches globally in org mode?
at https://emacs.stackexchange.com/questions/33971/is-it-possible-to-define-source-block-switches-globally-in-org-mode
demonstrates the usefulness of this feature.
Reading part of the orgmode-manual (http://orgmode.org/manual/Literal-examples.html#Literal-examples), scanning the customization options,
and inspecting the source code gave me the impression that this is not
implemented yet. So, I am filing that as an enhancement request.
1. It should be possible to customize the default settings of the
switches
2. It should be possible to change the default settings of the switches
tree-locally through setting a property. That includes file-local
settings if one sets the property before the first headline.
3. Explicit inner settings should override outer settings, e.g.,
tree-local settings override the customization options and explicit headline
switches override the tree-local settings.
4. For each switch there should also be a negative switch. E.g., if line
numbering is enabled through the customization option it should be
possible to disable it with a tree-local setting or with the source
block headline switches.
Thanks for considering this feature request.
With best regards,
Tobias
======================================================================
Emacs : GNU Emacs 25.1.50.2 (i686-pc-linux-gnu, GTK+ Version 3.10.8)
of 2016-04-25
Package: Org mode version 9.0.5 (9.0.5-elpa @ /home/username/.emacs.d/elpa/org-20170210/)
current state:
==============
(setq
org-entities-user '(("frowney" "\\frowney" nil "੏" ":-(" ":-(" "☹")
("smiley" "\\smiley" nil "ća;" ":-)" ":-)" "☺")
("blacksquare" "\\blacksquare" nil "A0;" "#" "#" "■")
("square" "\\square" nil "□" "| |" "| |" "□")
("ldots" "\\ldots" nil "…" "..." "..." "…")
("times" "\\times" t "×" "x" "x" "×")
("mapsto" "\\mapsto" t "↦" "|->" "|->" "↦")
("neg" "\\neg" t "&neg;" "/" "/" "¬")
("greatergreater" "\\gg" t "⪢" ">>" ">>"
"⪢")
("nbsp" "\\medspace" t " " " " " " " ")
("greatereq" "\\geq" t "&greatereq;" ">=" ">=" "≥")
("lesseq" "\\leq" t "&lesseq;" "<=" "<=" "≤")
("lessless" "\\ll" t "⪡" "<<" "<<" "⪡")
("sqrt" "\\sqrt" t "√" "sqrt" "sqrt" "√")
("plusminus" "\\pm" t "±" "+-" "+-" "±")
("bull" "\\bullet" nil "•" "*" "*" "•"))
org-ctrl-c-ctrl-c-hook '(org-update-formula calc-inline-maybe)
org-latex-format-headline-function 'org-latex-format-headline-default-function
org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
org-cycle-level-after-item/entry-creation nil
org-tab-first-hook '(org-cycle-item-indentation
org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-link-parameters '(("rmail" :follow org-rmail-open :store
org-rmail-store-link)
("mhe" :follow org-mhe-open :store org-mhe-store-link)
("irc" :follow org-irc-visit :store org-irc-store-link)
("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
("gnus" :follow org-gnus-open :store
org-gnus-store-link)
("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
("w3m" :store org-w3m-store-link)
("id" :follow org-id-open)
("T" :follow org-trac-follow :export org-trac-export)
("H" :follow org-HD-follow :export org-HD-export)
("file+sys") ("file+emacs")
("doi" :follow org--open-doi-link)
("elisp" :follow org--open-elisp-link)
("file" :complete org-file-complete-link)
("ftp" :follow
(lambda (path) (browse-url (concat "ftp:" path))))
("help" :follow org--open-help-link)
("http" :follow
(lambda (path) (browse-url (concat "http:" path))))
("https" :follow
(lambda (path) (browse-url (concat "https:" path))))
("mailto" :follow
(lambda (path) (browse-url (concat "mailto:" path))))
("message" :follow
(lambda (path) (browse-url (concat "message:" path))))
("news" :follow
(lambda (path) (browse-url (concat "news:" path))))
("shell" :follow org--open-shell-link))
org-archive-hook '(org-attach-archive-delete-maybe)
org-preview-latex-process-alist '((dvips :programs ("latex" "dvips" "gs")
:description "latex → dvips → gs → png"
:message
"Required programs: latex dvips gs"
:image-input-type "dvi" :image-output-type
"png" :latex-compiler
("latex -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvips -E %f -o %f.body.ps; echo -e \"%%!PS-Adobe-3.0 EPSF-3.0\\n%%%%Creator: dvips\\n%%%%Pages: 1\" > %f.bbi; gs -q -r%D -dSAFER -sDEVICE=bbox -dNOPAUSE -dBATCH %f.body.ps 2>> %f.bbi; echo -e \"\\n%%%%EndComments\\n%%%%BeginProlog\" >> %f.bbi; cat %f.bbi %f.body.ps > %f.ps; gs -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dAlignToPixels=0 -dDOINTERPOLATE -r%D -dNOPAUSE -dBATCH -sOutputFile=%O -dEPSCrop %f.ps")
)
(dvipng :programs ("latex" "dvipng")
:description "dvi > png" :message
"you need to install the programs: latex and dvipng."
:image-input-type "dvi" :image-output-type
"png" :image-size-adjust (1.0 . 1.0)
:latex-compiler
("latex -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvipng -fg %F -bg %B -D %D -T tight -o %O %f")
)
(dvisvgm :programs ("latex" "dvisvgm")
:description "dvi > svg" :message
"you need to install the programs: latex and dvisvgm."
:use-xcolor t :image-input-type "dvi"
:image-output-type "svg"
:image-size-adjust (1.7 . 1.5)
:latex-compiler
("latex -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvisvgm %f -n -b min -c %S -o %O"))
(imagemagick :programs ("latex" "convert")
:description "pdf > png" :message
"you need to install the programs: latex and imagemagick."
:use-xcolor t :image-input-type "pdf"
:image-output-type "png"
:image-size-adjust (1.0 . 1.0)
:latex-compiler
("pdflatex -interaction nonstopmode -output-directory %o %f")
:image-converter
("convert -density %D -trim -antialias %f -quality 100 %O")
)
)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-confirm-babel-evaluate nil
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-babel-pre-tangle-hook '(save-buffer)
org-occur-hook '(org-first-headline-recenter)
org-html-format-headline-function 'org-html-format-headline-default-function
org-structure-template-alist '(("m" org-structure-template-latex
org-structure-template-latex)
("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
("v" "#+BEGIN_VERSE\n?\n#+END_VERSE")
("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
("c" "#+BEGIN_CENTER\n?\n#+END_CENTER")
("l" "#+BEGIN_EXPORT latex\n?\n#+END_EXPORT")
("L" "#+LaTeX: ")
("h" "#+BEGIN_EXPORT html\n?\n#+END_EXPORT")
("H" "#+HTML: ")
("a" "#+BEGIN_EXPORT ascii\n?\n#+END_EXPORT")
("A" "#+ASCII: ") ("i" "#+INDEX: ?")
("I" "#+INCLUDE: %file ?"))
org-metaup-hook '(org-babel-load-in-session-maybe)
org-confirm-elisp-link-function 'y-or-n-p
org-descriptive-links nil
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
org-src-tab-acts-natively t
org-export-backends '(ascii html icalendar latex odt tracTZA)
org-preview-latex-default-process 'dvips
org-highlight-latex-and-related '(latex)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-ascii-text-width 1000
org-image-actual-width '(400)
org-mode-hook '(#[0
"\305\306 >\203\0\307\n\310\311#\210\307\v\312\313#\210\307\v\314\315#\210\306 >\203,\307\n\316\317#\210\307\n\320\321#\210\322 >\203>\307\v\323\324#\210\307\v\325\324#\210\326 >\203P\307\n\327\317#\210\307\n\330\321#\210\331 >\203_\332\311\f\333BC\334#\210\335 >\203k\332\311\336\334#\210\337 >\203w\332\311\340\334#\210\341\342\343\344\311$\210\345\342\311\"\210\342\207"
[org-mouse-context-menu-function
org-mouse-features
org-mouse-map
org-mode-map
org-outline-regexp
org-mouse-context-menu
context-menu
org-defkey
[mouse-3]
nil
[mouse-3]
org-mouse-show-context-menu
[down-mouse-1]
org-mouse-down-mouse
[C-drag-mouse-1]
org-mouse-move-tree
[C-down-mouse-1]
org-mouse-move-tree-start
yank-link
[S-mouse-2]
org-mouse-yank-link
[drag-mouse-3]
move-tree
[drag-mouse-3]
[down-mouse-3]
activate-stars
font-lock-add-keywords
(0
(\`
(face
org-link
mouse-face
highlight
keymap
(\, org-mouse-map)
)
)
(quote prepend)
)
t
activate-bullets
(("^[ ]*\\([-+*]\\|[0-9]+[.)]\\) +"
(1
(\`
(face
org-link
keymap
(\, org-mouse-map)
mouse-face highlight)
)
(quote prepend)
)
)
)
activate-checkboxes
(("^[ ]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)"
(2
(\`
(face
bold
keymap
(\, org-mouse-map)
mouse-face highlight)
)
t)
)
)
ad-add-advice
org-open-at-point
(org-mouse-open-at-point
nil
t
(advice
lambda
nil
(let
((context
(org-context)
)
)
(cond
((assq :headline-stars context)
(org-cycle)
)
((assq :checkbox context)
(org-toggle-checkbox)
)
((assq :item-bullet context)
(let
((org-cycle-include-plain-lists t)
)
(org-cycle)
)
)
((org-footnote-at-reference-p)
nil)
(t ad-do-it)
)
)
)
)
around ad-activate]
5]
org-hook-todo-regexp
(lambda nil
(local-set-key (kbd "C-c b") (quote org-insert-block)))
(lambda nil
(add-hook (quote text-scale-mode-hook)
(quote org-text-scale-eye))
)
org+-org-mode-hook-function
(lambda nil (local-set-key (kbd "C-c p") (quote org-patch)))
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-show-block-all append
local]
5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-babel-show-result-all
append local]
5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-agenda-mode-hook '(#[0
"\302\303 \304\305#\210\303 \306\307#\210\303 \310\311#\210\303 \312\313#\210\303 \314\315#\207"
[org-mouse-context-menu-function
org-agenda-mode-map
org-mouse-agenda-context-menu
org-defkey
[mouse-3]
org-mouse-show-context-menu
[down-mouse-3]
org-mouse-move-tree-start
[C-mouse-4]
org-agenda-earlier
[C-mouse-5]
org-agenda-later
[drag-mouse-3]
#[257
"\300!\301\302\"\203\0\303\304!\202\0\301\305\"\205\0\306\304!\207"
[org-mouse-get-gesture eql :left org-agenda-earlier 1 :right org-agenda-later]
5 "\n\n(fn EVENT)" "e"]
]
4]
)
org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-from-is-user-regexp "\\<Tobias Zawada\\>"
org-font-lock-set-keywords-hook '(org-hook-font-lock-todo
org-hidden-links-hook-function
(lambda nil
(let
((el
(assoc-string "{{{.+}}}"
org-font-lock-extra-keywords)
)
)
(when el (setcar el "{{{.+?}}}")))
(add-to-list
(quote org-font-lock-extra-keywords)
(quote
("^[[:blank:]]*\\([?!]\\):[^?!]*\\1$"
(0
(quote org-question-exclamation-face)
t)
)
)
)
(add-to-list
(quote org-font-lock-extra-keywords)
(quote
("^[[:blank:]]*[A-Z][A-Z]+:.*$"
(0
(quote org-user-defined-keywords-face)
t)
)
)
)
)
org-dont-underline-indents)
org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-src-preserve-indentation t
org-hide-emphasis-markers t
org-odt-format-headline-function 'org-odt-format-headline-default-function
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-clock-display-default-range 'untilnow
org-src-mode-hook '(hack-local-variables org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer
org+-src-mode-configure-edit-file-buffer-name)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
org-babel-tangle-lang-exts '(("ruby" . "rb") ("python" . "py")
("perl" . "pl") ("maxima" . "max") ("D" . "d")
("C++" . "cpp") ("emacs-lisp" . "el")
("elisp" . "el"))
org-babel-load-languages '((C . t) (ditaa . t) (dot . t) (emacs-lisp . t)
(gnuplot . t) (maxima . t) (octave . t) (perl . t)
(python . t) (R . t) (ruby . t) (shell . t)
(sqlite . t) (calc . t))
org-bbcode-after-export-hook '(org-bbcode-apply-delete-char)
org-metareturn-hook '(org-metareturn-insert-item)
org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
org-confirm-shell-link-function 'y-or-n-p
)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)]
2017-07-06 6:12 Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)] Tobias Zawada
@ 2017-07-06 7:03 ` Rasmus
2017-07-06 7:33 ` Tobias Zawada
2017-08-28 8:12 ` Nicolas Goaziou
1 sibling, 1 reply; 4+ messages in thread
From: Rasmus @ 2017-07-06 7:03 UTC (permalink / raw)
To: emacs-orgmode
Tobias Zawada <i@tn-home.de> writes:
> At first I would like to ask whether it is already possible to change
> the default settings of the source block header line switches.
Couldn't you use #+property headers?
E.g.
#+PROPERTY: header-args:R :session *R*
See:
http://orgmode.org/org.html#Using-header-arguments
Hope it helps,
Rasmus
--
I feel emotional landscapes they puzzle me
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)]
2017-07-06 7:03 ` Rasmus
@ 2017-07-06 7:33 ` Tobias Zawada
0 siblings, 0 replies; 4+ messages in thread
From: Tobias Zawada @ 2017-07-06 7:33 UTC (permalink / raw)
To: emacs-orgmode, Rasmus
Dear Rasmus,
thanks for the fast reply.
> Rasmus <rasmus@gmx.us> wrote on July, 6th 2017, 09:03:
>
> Tobias Zawada <i@tn-home.de> writes:
>
> > At first I would like to ask whether it is already possible to change
> > the default settings of the source block header line switches.
>
> Couldn't you use #+property headers?
> E.g.
>
> #+PROPERTY: header-args:R :session *R*
>
> See:
>
> http://orgmode.org/org.html#Using-header-arguments
No, switches and header arguments are (pityingly) two different concepts.
Currently, switches cannot be modified via header arguments.
But, you are partially right, It could be one solution of this enhancement request to introduce header-arguments for all switches, e.g., :sw-n, :sw+n. The values of those header arguments could be t and nil or, e.g., :sw+n 10.
Then the full mechanism for header arguments would work for switches.
See the description of switches at http://orgmode.org/manual/Literal-examples.html.
Best regards,
Tobias
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)] 2017-07-06 6:12 Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)] Tobias Zawada 2017-07-06 7:03 ` Rasmus @ 2017-08-28 8:12 ` Nicolas Goaziou 1 sibling, 0 replies; 4+ messages in thread From: Nicolas Goaziou @ 2017-08-28 8:12 UTC (permalink / raw) To: Tobias Zawada; +Cc: emacs-orgmode Hello, Tobias Zawada <i@tn-home.de> writes: > At first I would like to ask whether it is already possible to change > the default settings of the source block header line switches. > > The question > >> Is it possible to define source block switches globally in org mode? It is only possible for some of them (i.e., "l" and "i"). > at https://emacs.stackexchange.com/questions/33971/is-it-possible-to-define-source-block-switches-globally-in-org-mode > demonstrates the usefulness of this feature. This is Emacs. It takes 3 seconds to register a macro (or to write a regexp) and have "-n" applied on all the blocks. Of course, a global setting is handier in this case. However, there is no way to negate a switch, so it would ultimately get in the way. > Reading part of the orgmode-manual (http://orgmode.org/manual/Literal-examples.html#Literal-examples), scanning the customization options, > and inspecting the source code gave me the impression that this is not > implemented yet. So, I am filing that as an enhancement request. > > 1. It should be possible to customize the default settings of the > switches > 2. It should be possible to change the default settings of the switches > tree-locally through setting a property. That includes file-local > settings if one sets the property before the first headline. > 3. Explicit inner settings should override outer settings, e.g., > tree-local settings override the customization options and explicit headline > switches override the tree-local settings. > 4. For each switch there should also be a negative switch. E.g., if line > numbering is enabled through the customization option it should be > possible to disable it with a tree-local setting or with the source > block headline switches. What you are looking for is a change of the switch syntax. Actually, merging switch and header arguments would bring automatically 2 3 4, e.g., #+begin_src emacs-lisp :n t ... #+end_src or #+begin_src emacs-lisp :n 10 ... #+end_src or #+begin_src emacs-lisp :n nil ... #+end_src This is backward incompatible, tho. But, more importantly, it introduces a slight shift in the source blocks paradigm. Unlike header arguments, switches do not depend on Babel. E.g., #+begin_src emacs-lisp :exports code ... #+end_src and #+header: :exports code #+begin_src emacs-lisp ... #+end_src are equivalent, but not #+begin_src emacs-lisp -n ... #+end_src and #+header: -n #+begin_src emacs-lisp ... #+end_src We could make a special case for :n :k :l :i :r, i.e., explicitly forbid them in #+header: lines, or handle them at the parser level. What do you think? Would you want to work on this? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-28 8:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-06 6:12 Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)] Tobias Zawada 2017-07-06 7:03 ` Rasmus 2017-07-06 7:33 ` Tobias Zawada 2017-08-28 8:12 ` Nicolas Goaziou
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).