Commit Graph

367 Commits

Author SHA1 Message Date
Nicolas Goaziou 3f601e218d org-src: Fix auto-saving of remote editing buffers
* lisp/org-src.el (org-src--auto-save-timer): No longer buffer-local.
(org-src-mode): Tiny refactoring so as to keep code under 80 columns.

Reported-by: Andreas Fuchs <asf@boinkor.net>
http://lists.gnu.org/archive/html/emacs-orgmode/2018-07/msg00002.html
2018-07-02 00:45:12 +02:00
Aaron Ecay 4afb7f747b Update declare-function calls for functions that have moved.
In cases where functions have moved from org.el into org-macs.el, it
is often possible to replace declare-function by (require 'org-macs)
2018-05-10 01:04:12 +01:00
Nicolas Goaziou 0dda9bf1c1 Mark `org-get-indentation' as obsolete
* lisp/org-macs.el (org-get-indentation): Move function...
* lisp/org-compat: ... here.
* lisp/ob-core.el (org-babel-demarcate-block):
(org-babel-insert-result):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
* lisp/org-capture.el (org-capture-place-item):
* lisp/org-clock.el (org-clock-in):
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-feed.el (org-feed-format-entry):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-list.el (org-in-item-p):
(org-list-struct):
(org-list-struct-apply-struct):
(org-list-item-body-column):
(org-toggle-item):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-fixup-indentation):
(org-cdlatex-environment-indent):
(org--get-expected-indentation):
(org-indent-region):
(org-toggle-fixed-width):
* lisp/ox.el (org-export-expand-include-keyword): Use
  `current-indentation' instead.
2018-05-09 01:26:31 +02:00
Nicolas Goaziou b148cb0864 Merge branch 'maint' 2018-05-02 23:55:12 +02:00
Nicolas Goaziou 631c4b703e org-src: Clear overlay in Org buffer after major mode change
* lisp/org-src.el (org-src--allow-write-back):
(org-src--auto-save-timer):
(org-src--babel-info):
(org-src--beg-marker):
(org-src--block-indentation):
(org-src--end-marker):
(org-src--from-org-mode):
(org-src--overlay):
(org-src--preserve-indentation):
(org-src--remote):
(org-src--saved-temp-window-config):
(org-src--source-type):
(org-src--tab-width): Define as local and permanent variable.

(org-src--edit-element):
(org-edit-src-code):
(org-edit-inline-src-code): Use `setq' instead of `setq-local'.

When major mode is changed in an edit buffer, the variables above
would be cleared and the overlay in the source buffer could not be
removed anymore.
2018-05-02 23:52:35 +02:00
Nicolas Goaziou eacf403172 org-src: Do not use `setq-local' when not necessary
* lisp/org-src.el (org-src--contents-for-write-back):
(org-src-mode):
(org-src-mode-configure-edit-buffer): Use `setq' instead of
`setq-local' on variable automatically buffer-local when set.
2018-05-02 23:35:00 +02:00
Nicolas Goaziou 8efcb62dc4 org-src: Add association between beamer and `latex-mode'
* lisp/org-src.el (org-src-lang-modes): Add an entry for "beamer".
  Improve docstring.
2018-05-01 23:17:40 +02:00
Bastien 25f99522ad org-src.el: Don't set `buffer-file-name'
* lisp/org-src.el (org-src-mode-configure-edit-buffer): Don't
set `buffer-file-name'.

Thanks to Clément Pit-Claudel for reporting this.
2018-04-27 00:25:15 +02:00
stardiviner 00938bc98b org-src: New option for `org-src-window-setup'.
org-src.el: (org-src-window-setup) support open edit src window below.

TINYCHANGE
2018-03-17 08:11:24 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00
Nicolas Goaziou 9bbee7d3c8 Add some `:safe' keywords
* lisp/org-src.el (org-edit-src-content-indentation):
* lisp/org.el (org-adapt-indentation): Add :safe keyword.
2017-12-17 11:01:25 +01:00
Nicolas Goaziou 3aa4d44ba8 Fix comma escaping with multiple leading commas
* lisp/org-src.el (org-escape-code-in-region):
(org-escape-code-in-string):
(org-unescape-code-in-region):
(org-unescape-code-in-string): Fix comma escaping with multiple
leading commas.

* testing/lisp/test-org-src.el (test-org-src/escape-code-in-string):
(test-org-src/unescape-code-in-string): New tests.

Reported-by: Michal Politowski <mpol@meep.pl>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00359.html>
2017-10-24 09:51:43 +02:00
Paul Eggert ff0dcf52a5 Backport commit bc511a64f from Emacs
Prefer HTTPS to FTP and HTTP in documentation
bc511a64f6da9ab51acc7c8865e80c4a4cb655c2
Paul Eggert
Wed Sep 13 15:54:37 2017 -0700
2017-09-17 00:28:38 -04:00
Nicolas Goaziou d50170b208 Tolerate editing an export block without type
* lisp/org-src.el (org-edit-export-block): Tolerate editing an export
  block without type.
2017-09-07 15:27:55 +02:00
Nicolas Goaziou e40d2df680 Merge branch 'maint' 2017-08-21 11:31:29 +02:00
Nicolas Goaziou 4df137420d org-src: Fix remote footnote edition
* lisp/org-src.el (org-src--edit-element): Ensure read-only overlay in
  source buffer is properly removed upon exiting the remote editing
  buffer.
2017-08-21 11:27:41 +02:00
Nicolas Goaziou a7e11643a9 Merge branch 'maint' 2017-08-06 10:31:06 +02:00
Nicolas Goaziou 9974ed39b2 org-src: Fix remote footnote edition
* lisp/org-src.el (org-edit-footnote-reference): Clone local variables
  in remote editing buffer.

* testing/lisp/test-org-src.el (test-org-src/footnote-references): Add
  test.
2017-08-06 10:30:48 +02:00
Nicolas Goaziou 7b3ec6c105 Merge branch 'maint' 2017-06-08 00:59:06 +02:00
Nicolas Goaziou 9f5c252f93 org-src: Fix footnote reference remote editing
* lisp/org-src.el (org-edit-footnote-reference): Do not collapse
  footnote definitions after editing remotely one of them.

* testing/lisp/test-org-src.el (test-org-src/footnote-references): New
  test.
2017-06-08 00:57:38 +02:00
Nicolas Goaziou 3b8037f316 org-src: Raise an error when source buffer is unreachable
* lisp/org-src.el (org-edit-src-exit): Raise an error when source
  buffer is unreachable.
2017-06-08 00:57:23 +02:00
Nicolas Goaziou 2a3443f142 Merge branch 'maint' 2017-04-29 11:48:45 +02:00
Nicolas Goaziou 91236a3db3 org-src: Fix indentation when tabs are involved
* lisp/org-src.el (org-src--source-type):
(org-src--tab-width): New variables.
(org-src--edit-element): Set variables above.

(org-src--contents-for-write-back): Re-indent properly non-blank lines
before inserting contents back into the source buffer.
(org-edit-src-code): Delegate block indentation to
`org-src--contents-for-write-back'.

* testing/lisp/test-org-src.el (test-org-src/indented-blocks): New
  test.

Reported-by: Brent Goodrick <bgoodr@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113207>
2017-04-29 11:45:45 +02:00
Nicolas Goaziou f64fd2a8f1 Merge branch 'maint' 2017-03-19 23:56:56 +01:00
Aaron Jensen 0ccd8286a1 org-src: Fix fontification error
* lisp/org-src.el (org-src-font-lock-fontify-block): Fix fontification
error introduced in commit f2a5104e45.

TINYCHANGE
2017-03-19 23:55:51 +01:00
Nicolas Goaziou 21797c3185 Merge branch 'maint' 2017-02-18 14:57:04 +01:00
Nicolas Goaziou 70872885be org-src: Fix typo in code comment
* lisp/org-src.el (org-edit-src-save): Fix typo.
2017-02-18 14:56:41 +01:00
Nicolas Goaziou 120b565054 Merge branch 'maint' 2017-02-17 22:33:16 +01:00
Nicolas Goaziou bf601016dc Properly save source blocks with `save-some-buffers'
* lisp/org-src.el (org-src-mode-configure-edit-buffer): Set
  `write-contents-functions' so that saving a remote editing buffer
  always call `org-edit-src-save'.
(org-edit-src-save): Return a non-nil value explicitly.

Reported-by: Thibault Polge <thibault@thb.lt>
<http://permalink.gmane.org/gmane.emacs.orgmode/112201>
2017-02-17 22:32:50 +01:00
Nicolas Goaziou 2b5fbfa473 Implement `org-edit-latex-environment'
* lisp/org-src.el (org-edit-latex-environment): New function.
* lisp/org.el (org-edit-special): Use new function.
2017-02-01 21:30:54 +01:00
Noam Postavsky f2a5104e45 Backport commit ae8264c5cc from Emacs
* lisp/org-src.el (org-src-font-lock-fontify-block): Let-bind
`inhibit-modification-hooks' to nil, since this function can be called
from jit-lock-function which binds that variable to t (Bug#25132).

Call modification hooks in org-src fontify buffers
ae8264c5cccf19d5b25a340a605bf2f07de1577e
Noam Postavsky
Sun Jan 29 11:01:32 2017 -0500
2017-01-29 13:16:09 -05:00
Kyle Meyer 7c710f6f57 Change :version in defcustoms from "25.2" to "26.1"
* lisp/ob-J.el (org-babel-J-command):
* lisp/ob-core.el (org-babel-hash-show-time):
* lisp/ob-exp.el (org-babel-exp-inline-code-template):
* lisp/ob-lisp.el (org-babel-lisp-eval-fn):
* lisp/org-agenda.el (org-agenda-view-columns-initially):
* lisp/org-attach.el (org-attach-commit):
(org-attach-archive-delete):
(org-attach-annex-auto-get):
* lisp/org-bibtex.el (org-bibtex-inherit-tags):
* lisp/org-clock.el (org-clock-into-drawer):
* lisp/org-colview.el (org-columns-summary-types):
* lisp/org-faces.el (org-block):
* lisp/org-src.el (org-src-block-faces):
* lisp/org-table.el (org-table-copy-increment):
(org-table-formula-create-columns):
(org-table-convert-region-max-lines):
* lisp/org-timer.el (org-timer-default-timer):
* lisp/org.el (org-export-backends):
(org-show-context-detail):
(org-cycle-hook):
(org-occur-case-fold-search):
(org-preview-latex-default-process):
(org-preview-latex-process-alist):
(org-preview-latex-image-directory):
(org-latex-default-packages-alist):
(org-sparse-tree-default-date-type):
(org-structure-template-alist):
(org-effort-durations):
(org-agenda-ignore-properties): Change :version from "25.2" to "26.1".
(customize-package-emacs-version-alist): Fix associations between Org
and Emacs releases.
* lisp/ox-ascii.el (org-ascii-list-margin):
* lisp/ox-beamer.el (org-beamer-subtitle-format):
* lisp/ox-html.el (org-html-format-headline-function):
(org-html-format-inlinetask-function):
(org-html-viewport):
* lisp/ox-latex.el (org-latex-caption-above):
(org-latex-prefer-user-labels):
(org-latex-subtitle-format):
(org-latex-hyperref-template):
(org-latex-footnote-defined-format):
(org-latex-images-centered):
(org-latex-default-figure-position):
(org-latex-text-markup-alist):
(org-latex-format-inlinetask-function):
(org-latex-custom-lang-environments):
(org-latex-compiler-file-string):
(org-latex-compiler):
(org-latex-bib-compiler):
(org-latex-logfiles-extensions):
(org-latex-known-warnings):
* lisp/ox-md.el (org-md-footnotes-section):
(org-md-footnote-format):
* lisp/ox-odt.el (org-odt-format-headline-function):
(org-odt-format-inlinetask-function):
(org-odt-inline-image-rules):
* lisp/ox-texinfo.el (org-texinfo-format-headline-function):
* lisp/ox.el (org-export-with-creator):
(org-export-with-title):
(org-export-with-broken-links):
(org-export-copy-to-kill-ring): Change :version from "25.2" to "26.1".

It looks like the goal is to sync Org 9.0.* (maint) with the Emacs
master branch (what will be version 26.1):
https://lists.gnu.org/archive/html/emacs-orgmode/2017-01/msg00558.html
2017-01-26 00:02:03 -05:00
Kyle Meyer 713f785017 Update copyright years 2017-01-05 20:19:37 -05:00
Nicolas Goaziou 3c64f06617 Allow coderef on otherwise empty lines
* lisp/org-src.el (org-src-coderef-regexp): Update regexp.
* lisp/ox.el (org-export-resolve-coderef): Use function above.

Reported-by: D M German <dmg@turingmachine.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/110656>
2016-12-07 23:11:10 +01:00
Nicolas Goaziou 5fd886c955 org-src: Silence byte-compiler 2016-10-25 13:23:31 +02:00
Nicolas Goaziou 1a88cf920e org-element: Improve support for pseudo objects and elements
* lisp/org-element.el (org-element-class): New function.
(org-element-map):
(org-element-interpret-data):
* lisp/org-footnote.el (org-footnote--allow-reference-p):
* lisp/org-src.el (org-src--on-datum-p):
* lisp/ox-odt.el (org-odt-footnote-reference):
(org-odt-table-cell):
* lisp/ox.el (org-export-data):
(org-export-expand): Use new function.

* testing/lisp/test-org-element.el (test-org-element/class): New test.

Using generic `org-element-class' allows to handle unknown, i.e.,
pseudo, object or element types.  It also reduces code duplication in
`org-element-interpret-data' and `org-export-data', preventing, e.g.,
bugs as the one fixed in c58e1b5.
2016-10-25 13:13:26 +02:00
Nicolas Goaziou 0cf58cc208 Improve docstrings
* lisp/ob-core.el (org-confirm-babel-evaluate):
(org-babel-no-eval-on-ctrl-c-ctrl-c):
(org-babel-hash-at-point):
* lisp/org-agenda.el (org-agenda-custom-commands):
(org-stuck-projects):
(org-agenda):
(org-timeline):
(org-todo-list):
(org-agenda-filter-by-tag):
(org-agenda-log-mode):
(org-agenda-refile):
(org-agenda-show-and-scroll-up):
(org-agenda-tree-to-indirect-buffer):
(org-agenda-show-the-flagging-note):
(org-agenda-to-appt):
* lisp/org-capture.el (org-capture-mode):
(org-capture-use-agenda-date):
(org-capture):
* lisp/org-clock.el (org-clock-in):
(org-clock-display):
* lisp/org-colview.el (org-columns--display-here):
(org-columns):
* lisp/org-footnote.el (org-footnote-section):
* lisp/org-gnus.el (org-gnus-prefer-web-links):
* lisp/org-lint.el (org-lint):
* lisp/org-list.el (org-plain-list-ordered-item-terminator):
(org-list-allow-alphabetical):
(org-list-automatic-rules):
(org-list-use-circular-motion):
* lisp/org-protocol.el (org-protocol-store-link):
(org-protocol-create-for-org):
* lisp/org-src.el (org-src-preserve-indentation):
(org-edit-src-content-indentation):
(org-src-mode-hook):
(org-src-mode):
(org-edit-table.el):
(org-edit-export-block):
(org-edit-src-code):
(org-edit-fixed-width-region):
* lisp/org-table.el (org-table-automatic-realign):
(org-table-copy-increment):
(org-table-formula-evaluate-inline):
(org-table-allow-automatic-line-recalculation):
(org-table-edit-field):
(orgtbl-ascii-plot):
* lisp/org-timer.el (org-timer):
* lisp/org.el (org-deadline-string):
(org-comment-string):
(org-ellipsis):
(org-show-context-detail):
(org-indirect-buffer-display):
(org-cycle-global-at-bob):
(org-insert-heading-respect-content):
(org-enable-table-editor):
(org-context-in-file-links):
(org-display-internal-link-with-indirect-buffer):
(org-file-apps):
(org-refile-targets):
(org-todo-keywords):
(org-use-fast-todo-selection):
(org-treat-insert-todo-heading-as-state-change):
(org-time-clocksum-use-fractional):
(org-time-clocksum-use-effort-durations):
(org-agenda-files):
(org-cycle-hide-archived-subtrees):
(org-cycle):
(org-global-cycle):
(org-tree-to-indirect-buffer):
(org-insert-heading):
(org-store-link):
(org-insert-link):
(org-mark-ring-push):
(org-refile):
(org-todo):
(org-show-todo-tree):
(org-reveal):
(org-check-deadlines):
(org-switchb):
(org-cdlatex-mode):
(org-toggle-latex-fragment):
(org-ctrl-c-ctrl-c):
(org-toggle-heading):
(org-indent-line):
(org-yank):
(org-speedbar-set-agenda-restriction):
* lisp/ox-html.el (org-html-htmlize-output-type):
* lisp/ox-icalendar.el (org-icalendar-combined-agenda-file):
* lisp/ox-publish.el (org-publish-project-alist):
* lisp/ox.el (org-export-in-background):
(org-export-stack-mode):
(org-export--stack-source-at-point):
(org-export-dispatch): Improve quotes and formatting in docstrings.
2016-10-15 17:43:54 +02:00
Nicolas Goaziou eb3dd6186d Silence byte-compiler
* lisp/org-faces.el (org-src-block-faces): Move it from here...
* lisp/org-src.el (org-src-block-faces): ... to here.
2016-09-24 10:52:49 +02:00
Aaron Ecay 79650ffbbd Use assq instead of assoc for :keywords
* lisp/ob-C.el (org-babel-C-execute):
* lisp/ob-J.el (org-babel-execute:J):
* lisp/ob-R.el (org-babel-edit-prep:R):
(org-babel-expand-body:R):
(org-babel-execute:R):
(org-babel-variable-assignments:R):
(org-babel-R-initiate-session):
* lisp/ob-abc.el (org-babel-execute:abc):
* lisp/ob-asymptote.el (org-babel-execute:asymptote):
* lisp/ob-awk.el (org-babel-execute:awk):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
(org-babel-execute:clojure):
* lisp/ob-core.el (org-babel-expand-body:generic):
(org-babel-load-in-session):
(org-babel-initiate-session):
(org-babel-open-src-block-result):
(org-babel-process-params):
(org-babel-insert-result):
(org-babel-expand-noweb-references):
* lisp/ob-ditaa.el (org-babel-execute:ditaa):
* lisp/ob-dot.el (org-babel-execute:dot):
* lisp/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp):
(org-babel-execute:emacs-lisp):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
(org-babel-exp-do-export):
(org-babel-exp-code):
* lisp/ob-forth.el (org-babel-execute:forth):
* lisp/ob-fortran.el (org-babel-execute:fortran):
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
(org-babel-expand-body:gnuplot):
(org-babel-execute:gnuplot):
* lisp/ob-groovy.el (org-babel-execute:groovy):
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-io.el (org-babel-execute:io):
* lisp/ob-java.el (org-babel-execute:java):
* lisp/ob-js.el (org-babel-execute:js):
* lisp/ob-latex.el (org-babel-execute:latex):
* lisp/ob-ledger.el (org-babel-execute:ledger):
* lisp/ob-lilypond.el (org-babel-lilypond-process-basic):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
(org-babel-execute:lisp):
* lisp/ob-lua.el (org-babel-execute:lua):
* lisp/ob-maxima.el (org-babel-execute:maxima):
* lisp/ob-mscgen.el (org-babel-execute:mscgen):
* lisp/ob-ocaml.el (org-babel-execute:ocaml):
* lisp/ob-octave.el (org-babel-execute:octave):
* lisp/ob-org.el (org-babel-execute:org):
* lisp/ob-perl.el (org-babel-execute:perl):
* lisp/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/ob-plantuml.el (org-babel-execute:plantuml):
* lisp/ob-python.el (org-babel-execute:python):
* lisp/ob-ruby.el (org-babel-execute:ruby):
* lisp/ob-sass.el (org-babel-execute:sass):
* lisp/ob-scala.el (org-babel-execute:scala):
* lisp/ob-scheme.el (org-babel-execute:scheme):
* lisp/ob-screen.el (org-babel-execute:screen):
(org-babel-prep-session:screen):
* lisp/ob-shell.el (org-babel-execute:shell):
(org-babel-variable-assignments:shell):
(org-babel-sh-evaluate):
* lisp/ob-shen.el (org-babel-execute:shen):
* lisp/ob-sql.el (org-babel-execute:sql):
* lisp/ob-sqlite.el (org-babel-execute:sqlite):
* lisp/ob-tangle.el (org-babel-tangle):
(org-babel-tangle-single-block):
* lisp/org-src.el (org-src-associate-babel-session):
* lisp/org.el (org-next-link):
Use `assq' instead of `assoc' with :keyword keys.
2016-09-23 11:20:09 +01:00
Nicolas Goaziou bfc9c815e2 org-src: Tiny fix
* lisp/org-src.el (org-src-font-lock-fontify-block): Ensure LANG is case
  insensitive.
2016-09-22 21:43:38 +02:00
Rasmus 687214a092 Fix e03e837
* lisp/org-src.el (org-src-font-lock-fontify-block): Fix typos and
  silence byte-compiler.
2016-09-22 09:34:31 +02:00
Rasmus e03e837168 org-src: New syntax for source blocks faces
* doc/org.texi (Editing source code): Document changes.
* lisp/org-faces.el (org-block): Update docstring.
  (org-src-block-faces): New defcustom for source-block faces.
* lisp/org-src.el (org-src-font-lock-fontify-block): Use
  org-src-block-faces.
* etc/ORG-NEWS: Update NEWS entry.
2016-09-22 09:31:43 +02:00
Nicolas Goaziou 6cb291a87b org-src: Silence byte-compiler 2016-08-19 16:19:36 +02:00
Nicolas Goaziou 3771f35f80 org-src: Fix coderef regexp
* lisp/org-src.el (org-src-coderef-regexp): A coderef label cannot be
  consist of white spaces only.

* testing/lisp/test-org-src.el (test-org-src/coderef-regexp): Add test.
2016-08-18 01:04:28 +02:00
Nicolas Goaziou 48af4166fd Consider edit buffers in `org-src-coderef-regexp'
* lisp/org-src.el (org-src-coderef-format): New function
(org-src-coderef-regexp): Change signature.

* lisp/ob-core.el (org-babel--normalize-body):
* lisp/ox.el (org-export-unravel-code): Use new functions.

* testing/lisp/test-org-src.el (test-org-src/coderef-format): New test.
2016-08-17 23:43:38 +02:00
Nicolas Goaziou 8e58c635ed org-src: Move function within library
* lisp/org-src.el (org-src-do-at-code-block): Move function definition
  out of Babel related section.
2016-08-17 23:37:55 +02:00
Nicolas Goaziou 9f47b37231 Ignore coderef labels when evaluating a code block
* lisp/ob-core.el (org-babel--normalize-body): New function.
(org-babel-get-src-block-info): Use new function.

* lisp/org-src.el (org-src-coderef-regexp): New function.
* lisp/ox.el (org-export-unravel-code): Use new function.

* testing/lisp/test-ob.el (test-ob/evaluate-body-with-coderefs): New
  test.
2016-08-08 14:04:11 +02:00