Commit Graph

462 Commits

Author SHA1 Message Date
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
Clément Pit--Claudel 4b9a634774 Copy all font-lock properties in org-src, not just face
* lisp/org-src (org-src-font-lock-fontify-block): Loop over
  `font-lock-extra-managed-props', thus copying other properties that
  might be applied using font-lock.  An example is composition, applied
  by `prettify-symbols-mode'.
2016-08-08 11:03:40 +02:00
Clément Pit--Claudel b7dd0e8511 Use font-lock-append-text-property to apply org-src faces
* lisp/org-src.el (org-src-font-lock-fontify-block): Replace anonymous
  faces with inheritance by lists of faces constructed by
  `font-lock-add-text-property`.  This properly deals with cases when
  the source buffer's `face' property is already a list.
2016-08-08 11:00:54 +02:00
Nicolas Goaziou 0bc3f9d58b org-src: Use cl-lib
* lisp/org-src.el (org-src-switch-to-buffer): Silence byte-compiler.
2016-07-25 16:01:15 +02:00
Nicolas Goaziou ff80654617 Mark `org-bound-and-true-p' as obsolete
* lisp/org-macs.el (org-bound-and-true-p): Remove macro.
* lisp/org-compat.el (org-bound-and-true-p): Deprecated alias for
  `bound-and-true-p'.
* lisp/ob-core.el (org-babel-confirm-evaluate):
* lisp/org-agenda.el (org-agenda-write):
(org-agenda-add-entry-text):
(org-agenda-todo):
* lisp/org-clock.el (org-clocktable-defaults):
(org-clocktable-write-default):
* lisp/org-colview.el (org-columns):
(org-columns--compute-spec):
(org-agenda-columns):
* lisp/org-indent.el (org-indent-set-line-properties):
* lisp/org-inlinetask.el (org-inlinetask-fontify):
* lisp/org-mobile.el (org-mobile-write-agenda-for-mobile):
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/options):
(pcomplete/org-mode/file-option/infojs_opt):
* lisp/org-src.el (org-src-mode-configure-edit-buffer):
(org-edit-table.el):
* lisp/org.el (org-store-link):
(org-refile):
(org-get-export-keywords):
(org-set-tags):
(org-order-calendar-date-args):
(org-mode-restart):
(org-tbl-menu):
(org-beginning-of-line):
(org-end-of-line):
(org-kill-line):
(org-truely-invisible-p):
(org-remove-flyspell-overlays-in): Use `bound-and-true-p' instead of
`org-bound-and-true-p'.
2016-06-23 14:23:52 +02:00
Nicolas Goaziou d13b0745dc Mark a few functions as obsolete
* lisp/ob-R.el (org-babel-variable-assignments:R):
* lisp/ob-ref.el (org-babel-ref-goto-headline-id):
* lisp/org-agenda.el (org-agenda-prepare-window):
(org-agenda-switch-to):
* lisp/org-capture.el (org-capture-goto-target):
* lisp/org-clock.el (org-clock-goto):
(org-clock-special-range):
* lisp/org-ctags.el (org-ctags-visit-buffer-or-file):
* lisp/org-eshell.el (org-eshell-open):
* lisp/org-feed.el (org-feed-show-raw-feed):
* lisp/org-id.el (org-id-goto):
* lisp/org-irc.el (org-irc-visit-erc):
* lisp/org-macs.el (org-string-nw-p):
* lisp/org-mobile.el (org-mobile-apply):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org.el (org-get-location):
(org-tree-to-indirect-buffer):
(org-mark-ring-goto):
(org-refile):
(org-add-log-note):
(org-revert-all-org-buffers):
(org-switchb):
(org-cycle-agenda-files):
(org-submit-bug-report):
(org-goto-marker-or-bmk):
* lisp/ox-html.el (org-html-htmlize-generate-css): Silence byte
  compiler.

The following functions are marked as obsolete:
- `org-string-match-p'
- `org-number-sequence'
- `org-floor*'
- `org-pop-to-buffer-same-window'
- `org-delete-directory'
- `org-buffer-narrowed-p'
2016-06-23 10:00:00 +02:00
Nicolas Goaziou 4f63cfabb3 Deprecate `org-babel-trim' in favor of `org-trim'
* lisp/org.el (org-trim): Add optional argument.

* contrib/lisp/ob-mathematica.el (org-babel-execute:mathematica):
* contrib/lisp/org-bibtex-extras.el (obe-html-export-citations):
* contrib/lisp/org-mime.el (org-mime-compose):
* lisp/ob-C.el (org-babel-C-execute):
* lisp/ob-calc.el (org-babel-execute:calc):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
* lisp/ob-core.el (org-babel-initiate-session):
(org-babel-parse-multiple-vars):
(org-babel-read-element):
(org-babel-insert-result):
(org-babel-expand-noweb-references):
(org-babel-trim): Mark obsolete.
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-fortran.el (org-babel-execute:fortran):
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-latex.el (org-babel-expand-body:latex):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
* lisp/ob-ocaml.el (org-babel-execute:ocaml):
* lisp/ob-octave.el (org-babel-octave-evaluate-session):
* lisp/ob-python.el (org-babel-python-evaluate-external-process):
(org-babel-python-evaluate-session):
* lisp/ob-ref.el (org-babel-ref-split-args):
* lisp/ob-ruby.el (org-babel-ruby-evaluate):
* lisp/ob-shell.el (org-babel-sh-evaluate):
* lisp/ob-table.el (org-sbe):
* lisp/ob-tangle.el (org-babel-spec-to-string):
* lisp/org-bibtex.el (org-bibtex-get):
* testing/lisp/test-ob.el (test-ob/parse-header-args): Use `org-trim'
  instead of `org-babel-trim'.
2016-06-21 15:33:00 +02:00
Rasmus b0def38b4b org-src: Allow per language block face
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Allow per-block
  face.

Suggested-by: Karl Voit <devnull <at> Karl-Voit.at>
<http://thread.gmane.org/gmane.emacs.orgmode/103833/focus=107645
2016-06-10 09:20:30 +02:00
Rasmus 81af689d0f org-src: Src-blocks also inherit org-block face
* lisp/org-src.el (org-src-font-lock-fontify-block): Inherit org-block
  face in addition to language specific faces.
* etc/ORG-NEWS: Add entry.
2016-06-09 16:18:17 +02:00
Nicolas Goaziou 0ac099a6f8 Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
  `org-detach-overlay', `org-file-equal-p', `org-float-time',
  `org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
  `org-looking-back', `org-propertize', `org-re' and
  `org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.

* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 13:56:25 +02:00
Nicolas Goaziou 1c923b9ae7 org-src: Allow writing remote edit buffers to file
* lisp/org-src.el (org-src-mode-configure-edit-buffer): Do not treat
  each save as meant to save source buffer.

Reported-by: David Dynerman <david@block-party.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/106998>
2016-05-11 23:18:38 +02:00
Kyle Meyer 23ca3fa100 Merge branch 'maint' 2016-01-29 00:28:48 -05:00
Kyle Meyer eb3b1046c6 org-src: Use font-lock-ensure to highlight blocks
* lisp/org-src.el (org-src-font-lock-fontify-block): Use
  org-font-lock-ensure instead of font-lock-fontify-buffer.

This replacement has previously been made (f36b19e, d81e6b5) and then reverted
(99f9999, 003a0f1) twice because source blocks were not being reliably
highlighted when font-lock-ensure was used instead of
font-lock-fontify-buffer.  This was due to a bug in font-lock-ensure
that has now been fixed (see Emacs's 21beb19 and bug#22399).

font-lock-ensure was introduced after Emacs 24.5, so this issue only
pertains to users with a developmental version of Emacs.
2016-01-29 00:28:42 -05:00
Stefan Monnier 12189858e8 Backport commit 1203e8a from Emacs
* lisp/ob-core.el (org-babel-check-confirm-evaluate)
(org-babel-map-src-blocks): Don't emit warnings if added vars are not used.
(*this*): Declare as dyn-bound.
(org-babel-expand-src-block, org-babel-load-in-session)
(org-babel-switch-to-session-with-code, org-babel-get-rownames):
Mark unused args.
(org-babel-combine-header-arg-lists): Remove unused var `args'.

* lisp/org-src.el (org-inhibit-startup):
Declare as dyn-bound.

lisp/org: Fix some compiler warnings
1203e8aecb7f49621af52cc13bc0e4427545dd4f
Stefan Monnier
Mon Jan 25 10:11:31 2016 -0500
2016-01-26 01:13:26 -05:00
Kyle Meyer 6345de2d05 Merge branch 'maint' 2016-01-09 17:43:27 -05:00
Kyle Meyer 6bc48c5f41 Update copyright years 2016-01-09 17:12:03 -05:00
Nicolas Goaziou fe04055b3d org-src: Silence byte-compiler
* lisp/org-src.el (org-edit-inline-src-code): Remove unused binding.
2015-11-10 23:54:41 +01:00
Nicolas Goaziou 6c1f63b6a6 org-src: Allow to edit remotely inline src blocks
* lisp/org-src.el (org-edit-inline-src-code): New function.
(org-src--contents-area): Handle inline src blocks.

* lisp/org.el (org-edit-special): When on an inline src block, edit it.
2015-11-08 20:55:31 +01:00
Aaron Ecay e4cd3dd22b Remove some home-grown copies of cl-lib functions.
* lisp/org.el (org-count, org-remove-if, org-remove-if-not):
(org-reduce, org-every, org-some): Obsolete, use cl-lib versions
everywhere.
(org-sublist): Reimplement in terms of `cl-subseq'; make obsolete.
2015-11-06 12:50:40 +00:00
Aaron Ecay 07e16c2fc5 Use setq-local and defvar-local.
* lisp/org-macs.el (org-set-local): Remove.  All callers changed.
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-macro.el:
* lisp/org-mouse.el:
* lisp/org-table.el:
* lisp/org.el: Use defvar-local.
* lisp/org-agenda.el:
* lisp/org-capture.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-plot.el:
* lisp/org.el:
* lisp/ox-odt.el:
* lisp/ox.el: Use setq-local instead of set + make-local-variable.

Changes in contrib:

* contrib/lisp/org-colview-xemacs.el (org-colview-xemacs-set-local): New
macro. Adjust old callers of `org-set-local'.
2015-11-05 16:47:38 +00:00
Nicolas Goaziou e868ef0886 Silence byte-compiler 2015-10-26 09:29:13 +01:00
Nicolas Goaziou f0bf77e82a Activate lexical binding in some libraries
* lisp/ob-C.el (org-babel-prep-session:C):
(org-babel-load-session:C):
* lisp/ob-J.el:
(org-babel-expand-body:J):
(org-babel-execute:J):
* lisp/ob-R.el:
(org-babel-expand-body:R):
* lisp/ob-abc.el:
(org-babel-execute:abc):
(org-babel-prep-session:abc):
* lisp/ob-asymptote.el:
(org-babel-execute:asymptote):
(org-babel-prep-session:asymptote):
* lisp/ob-awk.el:
(org-babel-expand-body:awk):
* lisp/ob-calc.el:
(org-babel-expand-body:calc):
* lisp/ob-clojure.el:
* lisp/ob-comint.el:
(org-babel-comint-in-buffer):
(org-babel-comint-with-output):
(org-babel-comint-eval-invisibly-and-wait-for-file):
* lisp/ob-coq.el:
* lisp/ob-css.el:
(org-babel-execute:css):
(org-babel-prep-session:css):
* lisp/ob-ditaa.el:
(org-babel-execute:ditaa):
(org-babel-prep-session:ditaa):
* lisp/ob-dot.el:
(org-babel-execute:dot):
(org-babel-prep-session:dot):
* lisp/ob-ebnf.el:
* lisp/ob-emacs-lisp.el:
* lisp/ob-eval.el:
* lisp/ob-forth.el:
* lisp/ob-fortran.el:
(org-babel-execute:fortran):
(org-babel-prep-session:fortran):
(org-babel-load-session:fortran):
* lisp/ob-gnuplot.el:
(org-babel-expand-body:gnuplot):
(org-babel-prep-session:gnuplot):
(org-babel-gnuplot-initiate-session):
* lisp/ob-groovy.el:
(org-babel-prep-session:groovy):
(org-babel-groovy-initiate-session):
* lisp/ob-haskell.el:
(org-babel-haskell-initiate-session):
* lisp/ob-io.el:
(org-babel-prep-session:io):
(org-babel-io-initiate-session):
* lisp/ob-java.el:
(org-babel-execute:java):
* lisp/ob-js.el:
* lisp/ob-keys.el:
* lisp/ob-latex.el:
(org-babel-prep-session:latex):
* lisp/ob-ledger.el:
(org-babel-execute:ledger):
(org-babel-prep-session:ledger):
* lisp/ob-lilypond.el:
(org-babel-lilypond-commands):
(org-babel-lilypond-process-basic):
(org-babel-prep-session:lilypond):
(org-babel-lilypond-parse-line-num):
* lisp/ob-lisp.el:
* lisp/ob-makefile.el:
(org-babel-execute:makefile):
(org-babel-prep-session:makefile):
* lisp/ob-matlab.el:
* lisp/ob-maxima.el:
(org-babel-prep-session:maxima):
* lisp/ob-mscgen.el:
(org-babel-prep-session:mscgen):
* lisp/ob-ocaml.el:
(org-babel-execute:ocaml):
(org-babel-prep-session:ocaml):
* lisp/ob-octave.el:
(org-babel-execute:octave):
(org-babel-octave-initiate-session):
* lisp/ob-org.el:
(org-babel-prep-session:org):
* lisp/ob-perl.el:
(org-babel-prep-session:perl):
(org-babel-perl--var-to-perl):
(org-babel-perl-initiate-session):
* lisp/ob-picolisp.el:
(org-babel-expand-body:picolisp):
(org-babel-execute:picolisp):
* lisp/ob-plantuml.el:
(org-babel-execute:plantuml):
(org-babel-prep-session:plantuml):
* lisp/ob-processing.el:
(org-babel-prep-session:processing):
* lisp/ob-python.el:
(org-babel-python-initiate-session):
* lisp/ob-ref.el:
(org-babel-ref-resolve):
* lisp/ob-ruby.el:
(org-babel-ruby-initiate-session):
* lisp/ob-sass.el:
(org-babel-execute:sass):
(org-babel-prep-session:sass):
* lisp/ob-scala.el:
(org-babel-execute:scala):
(org-babel-prep-session:scala):
(org-babel-scala-initiate-session):
* lisp/ob-scheme.el:
* lisp/ob-screen.el:
(org-babel-prep-session:screen):
(org-babel-screen-session-write-temp-file):
(org-babel-screen-test):
* lisp/ob.el:
* lisp/org-colview.el:
(org-columns-todo):
(org-columns-set-tags-or-toggle):
(org-columns-new):
(org-columns-uncompile-format):
(org-agenda-colview-summarize):
* lisp/org-footnote.el:
(electric-indent-mode):
* lisp/org-indent.el:
(org-indent-refresh-maybe):
* lisp/org-list.el:
* lisp/org-macro.el:
(org-macro--collect-macros):
* lisp/org-src.el:
* lisp/org-table.el:
(sort-fold-case):
(org-table-create):
(org-table-field-info):
(org-table-transpose-table-at-point):
(org-table-remove-rectangle-highlight):
(orgtbl-create-or-convert-from-region):
(org-define-lookup-function):
* lisp/ox-ascii.el:
(org-ascii-format-drawer-function):
(org-ascii--has-caption-p):
(org-ascii-bold):
(org-ascii-center-block):
(org-ascii-clock):
(org-ascii-code):
(org-ascii-dynamic-block):
(org-ascii-entity):
(org-ascii-example-block):
(org-ascii-export-snippet):
(org-ascii-export-block):
(org-ascii-fixed-width):
(org-ascii-footnote-reference):
(org-ascii-horizontal-rule):
(org-ascii-inline-src-block):
(org-ascii-format-inlinetask-default):
(org-ascii-italic):
(org-ascii-keyword):
(org-ascii-latex-environment):
(org-ascii-latex-fragment):
(org-ascii-line-break):
(org-ascii-node-property):
(org-ascii-planning):
(org-ascii-quote-block):
(org-ascii-radio-target):
(org-ascii-special-block):
(org-ascii-src-block):
(org-ascii-statistics-cookie):
(org-ascii-subscript):
(org-ascii-superscript):
(org-ascii-strike-through):
(org-ascii-timestamp):
(org-ascii-underline):
(org-ascii-verbatim):
(org-ascii-verse-block):
(org-ascii-filter-headline-blank-lines):
(org-ascii-filter-paragraph-spacing):
(org-ascii-filter-comment-spacing): Use lexical binding.
2015-10-26 01:56:00 +01:00
Nicolas Goaziou 50a18201c7 org-src: Preserve tab characters unrelated to indentation
* lisp/org-src.el (org-edit-src-code): Always preserve tabs not related
  to indentation.

* testing/lisp/test-org-src.el (test-org-src/preserve-tabs): New test.
2015-10-08 18:57:30 +02:00
Kyle Meyer d77a52a502 Backport quote-related commits from Emacs
These changes are the combination of the commits below (in order
applied).  Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits.  Changes to message and help quote
display for Emacs 25 seem to be here to stay.  The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.

  Quoting fixes in lisp/org
  6cd2629bd1b3ce77d29ac28e29237c94a4197116
  Paul Eggert
  Mon Aug 31 00:29:40 2015 -0700

  More-conservative ‘format’ quote restyling
  fbb5531fa11d13854b274d28ccd329c9b6652cfc
  Paul Eggert
  Sun Aug 23 22:39:06 2015 -0700

  Prefer directed to neutral quotes
  875a5d0ead827d3da32ecbd30e739a29f07bbc87
  Paul Eggert
  Mon Aug 24 23:57:25 2015 -0700

  Escape ` and ' in doc
  19532d147b431a4fe34f088d6de07891c48e2c5c
  Paul Eggert
  Tue Sep 1 18:23:21 2015 -0700

  Fix some more docstring etc. quoting problems
  26bd978d87dfbf9baa115cd961a67d42b416c4bf
  Paul Eggert
  Thu Sep 3 15:32:54 2015 -0700

  Go back to grave quoting in source-code docstrings etc.
  6afef3f6ca2f3009c722b84e249903b7f807b044
  Paul Eggert
  Mon Sep 7 16:09:27 2015 -0700
2015-09-21 18:38:18 -04:00
Nicolas Goaziou 6539b0d3f9 org-footnote: Fix remote editing of empty definitions
* lisp/org-src.el (org-edit-footnote-reference): Fix remote editing of
  empty definitions.
2015-08-14 16:48:41 +02:00
Nicolas Goaziou 719a201c3b org-src: Fix remote editing
* lisp/org-src.el (org-src--contents-area): Make sure buffer is widened
  before extracting contents of area.
2015-08-14 00:17:47 +02:00
Kyle Meyer 003a0f1069 org-src: Use font-lock-fontify-buffer for blocks
* lisp/org-src.el (org-src-font-lock-fontify-block): Use
  font-lock-fontify-buffer because font-lock-ensure does not display
  source block fonts.

When font-lock-fontify-buffer was originally replaced by
font-lock-ensure, source block fonts were not being displayed, so
99f9999 reverted this change.  However, a backport (d81e6b5) from the
Emacs repo, which was merged to master in 0d0d0ad, reverted this again.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99495>
2015-08-04 23:50:59 -04:00
Kyle Meyer 6f9184a294 Merge branch 'maint' into backport-master 2015-07-26 23:56:50 -04:00
Kyle Meyer c115c7b4e8 org-compat: Use different font-lock-ensure alias
* lisp/org-compat.el (org-font-lock-ensure): Remove in favor of
  font-lock-ensure alias from dcbaebc.

Instead of org-font-lock-ensure alias introduced in dcbaebc ("Backport
commit 6711a21 from Emacs master branch", 2014-05-28), use
font-lock-ensure alias added in e6883dd ("org-compat: Provide
compatibility definition for font-lock-ensure", 2014-06-01).
2015-07-26 23:29:14 -04:00
Stefan Monnier d81e6b52b7 Backport commit 6711a21 from Emacs master branch
* lisp/org-compat.el (org-font-lock-ensure): New function.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-html.el (org-html-fontify-code):
* lisp/org.el (org-fontify-like-in-org-mode):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org-clock.el (org-clock-get-clocktable): Use it.
* lisp/ox-org.el (org-org-publish-to-org):
Use it. Avoid using find-file from Elisp.

6711a21f1125c0047c56eb266eb374c1ec90a967
Stefan Monnier
Wed May 28 23:45:29 2014 -0400
2015-07-26 23:28:25 -04:00
Nicolas Goaziou f91d194d4f org-src: Fix `org-(un)escape-code-in-region'
* lisp/org-src.el (org-escape-code-in-region):
(org-unescape-code-in-region): Fix functions.

Reported-by: Daimrod <daimrod@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98099>
2015-06-02 17:17:17 +02:00
Nicolas Goaziou a0c1e490b3 Silence byte-compiler
* lisp/org-footnote.el:
* lisp/org-list.el:
* lisp/org-macro.el:
* lisp/org-src.el:
* lisp/org.el: Silence byte-compiler.
2015-05-30 14:28:35 +02:00
Nicolas Goaziou a33acf6191 org-src: Fix indentation rampage when editing src blocks
* lisp/org-src.el (org-edit-src-code): Do not add indentation at every
  edit when `org-src-preserve-indentation' is non-nil.

Function taking care of indentation cannot check
`org-src--preserve-indentation' since the variable is buffer-local and
indentation happens in a temporary buffer.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97927>
2015-05-29 09:55:56 +02:00
Nicolas Goaziou 3062753e16 org-src: Change ambiguous variable name
* lisp/org-src.el (org-src--preserve-indentation): New variable.
(org-src--contents-for-write-back):
(org-src--edit-element):
(org-edit-src-code): Use new change.

Before this change `org-src-preserve-indentation' was both a defcustom
and an internal local variable.  Both uses are now separated.
2015-05-26 21:47:05 +02:00
Nicolas Goaziou 59da320b30 org-src: Fix auto-save feature
* lisp/org-src.el (org-src-mode): Do not stop auto save feature when
  current buffer is no longer an edit buffer.

Reported-by: Andreas Leha <andreas.leha@med.uni-goettingen.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97892>
2015-05-26 17:06:53 +02:00
Nicolas Goaziou 5b3d47cf56 org-src: Fix error when editing footnote references
* lisp/org-src.el (org-src--contents-area): Define BEG and END.
2015-05-26 01:17:34 +02:00
Kyle Meyer e50472d926 org-src: Fix reference to free variable
* lisp/org-src.el (org-src--contents-area): Replace a let with let*.
2015-05-23 21:52:06 +02:00
Nicolas Goaziou 71641bc3a0 org-src: Fix escaping in remote editing
* lisp/org-src.el (org-src--contents-area): Include contents to be
  inserted in the edit buffer in return value.
(org-src--edit-element): Apply change above.

Reported-by: Kyle Meyer <kyle@kyleam.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97784>
2015-05-22 20:59:31 +02:00
Nicolas Goaziou 9e52d2ed01 org-src: Allow to edit inline footnote references
* lisp/org-src.el (org-src--edit-element): Do not rely on :value to
  extract contents.  Small refactoring.
(org-src--contents-area): Renamed from
  `org-src--element-contents-area'.  Throw an error on unknown
  elements.
(org-src--on-datum-p): Rename from `org-src--on-element-p'.  Handle
objects.
(org-edit-export-block, org-edit-src-code,
org-edit-fixed-width-region, org-edit-table.el): Apply renaming.
(org-edit-src-save, org-edit-src-exit): Handle inline text.
(org-edit-src-exit): Allow empty or blank code.  Handle inline text.
(org-src--edit-element): Rename an argument
(org-edit-footnote-reference): Allow to edit inline definitions.

* etc/ORG-NEWS: Document new feature.
2015-05-02 16:45:51 +02:00
Nicolas Goaziou f8d1d373fc org-src: Make area being edited read-only
* lisp/org-src.el (org-src--make-source-overlay): Add read-only
  feature to overlay.
(org-edit-src-save): Adapt to change above.
2015-05-01 21:14:19 +02:00
Nicolas Goaziou 427403d0bb org-src: Remove `org-src--type'
* lisp/org-src.el (org-src--type): Remove variable.
(org-src--contents-for-write-back): Apply removal.
(org-edit-src-code): Add indentation in post-process.
2015-05-01 18:46:33 +02:00
Nicolas Goaziou bce77d0db3 org-src: Fix "not in a sub-edit buffer" error on save
* lisp/org-src.el (org-src-mode): Fix "not in a sub-edit buffer" error
  on save.

Reported-by: Detlef Steuer <detlef.steuer@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97349>
2015-05-01 10:29:05 +02:00
Nicolas Goaziou d289eb9361 org-src: Fix docstrings
* lisp/org-src.el (org-src-mode-hook):
(org-edit-src-code): Fix docstrings.
2015-05-01 10:03:17 +02:00
Nicolas Goaziou 0046955e23 org-src: Fix docstrings
* lisp/org-src.el (org-src-mode-hook):
(org-src-mode): Fix docstring.
(org-src-mode-map): Refactor.
2015-05-01 09:49:14 +02:00
Nicolas Goaziou ea575950d9 org-src: Tiny fix
* lisp/org-src.el (org-src-mode): Tiny fix.
2015-04-29 13:25:34 +02:00
Nicolas Goaziou bf01f6fe66 org-src: Small fix to auto-save feature
* lisp/org-src.el (org-src-mode): Trigger auto-save even when current
  buffer is not and edit buffer.
2015-04-29 13:23:36 +02:00
Nicolas Goaziou bad0409c3b org-src: Small refactoring
* lisp/org-src.el (org-src--auto-save-timer): Renamed from
  `org-src--code-timer'.
(org-src--edit-element):
(org-src-mode): Enable auto-save features in minor mode.  Apply
variable renaming.
2015-04-29 13:16:21 +02:00
Nicolas Goaziou 21b6b1d9a2 org-src: Fix editing remotely empty footnote definitions
* lisp/org-src.el (org-src--element-contents-area):
(org-edit-footnote-reference): Take into consideration
that :contents-begin and :contents-end may be nil.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/97262>
2015-04-28 00:22:20 +02:00
Nicolas Goaziou 9d4b3e356f org-src: Refuse to edit remotely inline footnotes
* lisp/org-src.el (org-edit-footnote-reference): Throw an error when
  definition is inline.
2015-04-26 14:58:54 +02:00
Nicolas Goaziou ca2b398396 org-src: Allow editing footnote definitions
* lisp/org-src.el (org-src--element-contents-area): Make a special
  case for footnote definitions.
(org-edit-footnote-reference): New function.
* lisp/org.el (org-edit-special): Use new function.
2015-04-26 11:44:35 +02:00
Nicolas Goaziou 58af85a4a2 org-src: Allow editing elements remotely
* lisp/org-src.el (org-src--remote-p): New variable.
(org-src--edit-element): Add optional argument.
(org-edit-src-exit): Handle new optional argument.
2015-04-26 11:37:52 +02:00
Nicolas Goaziou c347b87ffe org-src: Allow to post-process edit buffer
* lisp/org-src.el (org-src--allow-write-back): Rename from
  `org-src--allow-write-back-p'.

(org-src--edit-element):
(org-src-mode-configure-edit-buffer):
(org-edit-src-abort):
(org-edit-src-exit): Apply renaming.

(org-src--contents-for-write-back):
(org-edit-export-block):
(org-edit-src-code):
(org-edit-fixed-width-region): Use post-process.
2015-04-26 11:13:37 +02:00
Nicolas Goaziou 5894a74500 org-src: Update copyright year 2015-02-18 14:58:36 +01:00
Nicolas Goaziou a5f1a3e4be org-src: Small refactoring
* lisp/org-src.el (org-src--remove-overlay): New function.
(org-src--edit-element, org-src-mode-configure-edit-buffer): Use new
function.
2015-02-18 02:05:57 +01:00
Nicolas Goaziou 2dd548a4e0 Merge branch 'maint' 2015-02-18 02:04:39 +01:00
Nicolas Goaziou c41bbc577e Fix "Wrong type argument: overlayp"
* lisp/org-src.el (org-src-mode-configure-edit-buffer): Fix "Wrong
  type argument: overlayp".

Changing major mode in a source edit buffer resets local variables
used to link it to source buffer.  As a consequence, overlay in source
buffer can no longer be found nor deleted.
2015-02-18 01:59:51 +01:00
Aaron Ecay 7c86747881 org-src: add a note about bogosity of read-only overlays
* lisp/org-src.el (org-src--make-source-overlay): Add a TODO comment.
2014-12-11 23:48:27 -05:00
Aaron Ecay 398286a00c org-src: fix two bugs
* lisp/org-src.el (org-src--edit-buffer): Construe equality for
markers properly.
(org-edit-src-save): Place point properly when writing back changes.

Thanks to Vikas Rawal for reporting:
<http://mid.gmane.org/C8148BF2-87AF-44A4-B103-6BD338DA8D96@agrarianresearch.org>
2014-12-11 23:34:35 -05:00
Oleh Krehel 433b66f2c7 org-src: allow `org-babel-edit-prep:.*' to mark region
* lisp/org-src.el (org-edit-src-code): Let `deactivate-mark' nil.

<http://permalink.gmane.org/gmane.emacs.orgmode/93053>
2014-12-09 17:26:02 +01:00
Nicolas Goaziou bde27ccacc org-src: Fix docstring
* lisp/org-src.el (org-src-ask-before-returning-to-edit-buffer): Fix
  docstring.  Move variable in appropriate section.
2014-11-24 00:07:39 +01:00
Nicolas Goaziou 203bf5870f org-src: Unify source editing tools
* lisp/org-src.el (org-src-strip-leading-and-trailing-blanklines,
  org-edit-src-force-single-line, org-edit-src-picture,
  org-edit-src-from-org-mode, org-edit-src-allow-write-back-p,
  org-edit-src-beg-marker, org-edit-src-end-marker,
  org-edit-src-overlay, org-edit-src-block-indentation,
  org-edit-src-saved-temp-window-config, org-edit-src-code-timer):
  Remove variables.
(org-src--allow-write-back-p, org-src--beg-marker,
org-src--block-indentation, org-src--code-timer, org-src--end-marker,
org-src--end-marker, org-src--from-org-mode, org-src--overlay,
org-src--saved-temp-window-config, org-src--type,
org-src--babel-info): New variables.

(org-src--construct-edit-buffer-name, org-src--edit-buffer,
org-src--source-buffer, org-src--get-lang-mode, org-src--coordinates,
org-src--goto-coordinates, org-src--element-contents-area,
org-src--make-source-overlay, org-src--on-element-p,
org-src--contents-for-write-back, org-src--edit-element,
org-edit-table.el, org-edit-export-block): New functions.
(org-edit-src-find-buffer, org-src-construct-edit-buffer-name,
org-src-tangle, org-src-in-org-buffer): Remove functions.

(org-edit-src-code, org-edit-fixed-width-region, org-edit-src-abort,
org-edit-src-save): Use new functions and variables.
(org-edit-src-exit): Use new functions and variables.  Change
signature.

* lisp/org.el (org-edit-special, org-indent-line, org-indent-region):
  Use new functions and variables.

* lisp/ob-core.el (org-babel-do-in-edit-buffer): Remove useless check.
(org-babel-expand-src-block): Apply signature change.

This patches resolves discrepancies between source editing tools and
globally simplifies process (auto-save feature, region
preservation...).  It introduces export block editing.  It also moves
internal variables and functions into an appropriate namespace and
delete some unused functions.
2014-11-24 00:07:39 +01:00
Nicolas Goaziou 9c06f8cce9 org-src: Remove unused functions and variables
* lisp/org-src.el (org-edit-src-region-extra): Remove variable.
(org-edit-src-find-region-and-lang, org-edit-src-get-lang,
org-edit-src-get-label-format, org-edit-src-get-indentation,
org-src-fontify-block, org-src-fontify-buffer): Remove functions.

(org-src-font-lock-fontify-block): Remove reference to removed
function in docstring.

Remove all functions and variables related to parsing, which is now
delegated to org-element.el.  Also reorder a defcustom and
a declaration in the library.
2014-11-22 20:59:08 +01:00
Nicolas Goaziou 3d45b4285b Merge branch 'maint' 2014-09-11 18:27:22 +02:00
Nicolas Goaziou 01f736b763 org-src: Fix idle auto-save feature
* lisp/org-src.el (org-edit-src-code): Fix regexp.
(org-edit-src-exit): Do not remove auto-save timer.  This is
handled by the timer itself.

`org-edit-src-save' calls `org-edit-src-exit', which then clears the
auto-save timer, thus preventing any further auto-saves before the
next `org-edit-src-code' call.

Thanks to Adriaan Sticker for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/90650
2014-09-11 18:21:41 +02:00
Bastien Guerry 98295a8a25 Remove useless declaration 2014-07-28 18:29:24 +02:00
Bastien Guerry 99f999944e org-src.el (org-src-font-lock-fontify-block): Do not use `font-lock-ensure'
* org-src.el (org-src-font-lock-fontify-block): Use
`font-lock-fontify-buffer' instead of `font-lock-ensure',
otherwise fonts are not displayed for src blocks.

Thanks to Mathäus Meyer for reporting this.
2014-07-28 00:34:55 +02:00
Eric Schulte 8ad20618d1 map alternate code blocks shell names to sh-mode
* lisp/org-src.el (org-src-lang-modes): Map alternate shell names to
  sh-mode.
2014-06-22 19:50:31 -04:00
Aaron Ecay 5ee0d29f57 Remove another vestige of org-mtags
* lisp/org-src.el (org-edit-src-find-region-and-lang): Remove old
<foo>-style tags.

This completes commit 94939bd
2014-06-21 21:38:32 -04:00
Bastien Guerry f36b19eef6 org.el: Send a warning when org-loaddefs.el could not be found
* org.el: Send a warning when org-loaddefs.el could not be
found in the directory where this org.el file is loaded from.

* ox-org.el (org-org-publish-to-org):
* ox-odt.el (org-odt-do-format-code):
* ox-html.el (org-html-fontify-code):
* org.el (org-fontify-like-in-org-mode):
* org-src.el (org-src-font-lock-fontify-block):
* org-clock.el (org-clock-get-clocktable): Use
`font-lock-ensure' instead of `font-lock-fontify-buffer'.

* org.el (org-outline-level, org-copy-subtree)
(org-sort-entries, orgstruct-setup, org-show-context)
(org-create-formula-image-with-dvipng)
(org-create-formula-image-with-imagemagick)
(org-goto-sibling, org-goto-first-child, org-show-entry): Use
`ignore-errors' instead of (condition-case nil ... (error nil)).

People trying to load org.el when org-loaddefs.el is not available
has been a major cause of trouble when installing Org.  The warning
tells them what they need to do.
2014-05-29 22:08:43 +02:00
Nicolas Goaziou 51ffcd02dd Rewrite `org-indent-line'
* lisp/org.el (org--get-expected-indentation,
  org--align-node-property): New functions.
(org-indent-line): Use new function.  Also merge functionalities with
`org-src-native-tab-command-maybe'.

* lisp/org-src.el (org-src-native-tab-command-maybe): Remove function.

* testing/lisp/test-org.el (test-org/indent-line): New test.
2014-05-07 17:39:52 +02:00
Aaron Ecay cb53665e55 Fix org-src-edit interaction with undo.
* org-src.el (org-edit-src-exit): Place an undo boundary before
writing changes back to parent buffer.

The previous code attempted to preserve the undo information in the
indirect buffer editing the source code, but this interacts poorly
with the undo system, and can lead to undo operations scrambling the
buffer.  The new approach means that edits made in the indirect buffer
cannot be undone piece-by-piece (instead, all changes made in the
indirect buffer constitute one “change” from the point of view of
undo), but the misbehavior of undo is (hopefully) now avoided.
2014-03-22 09:40:18 +01:00
Bastien Guerry e1ede2271c org-src.el (org-src-preserve-indentation): Reformat docstring
* org-src.el (org-src-preserve-indentation): Reformat
docstring.
2014-03-15 07:42:19 +01:00
Bastien Guerry 07347025ee Merge branch 'maint' 2014-03-14 09:59:38 +01:00
Bastien Guerry 49a9c2b213 Fix 9323857 (again^2)
Thanks to Florian Beck for providing the right fix.
2014-03-14 09:59:28 +01:00
Bastien Guerry 6a57319d47 Merge branch 'maint' 2014-03-13 19:08:00 +01:00
Bastien Guerry 5ef5e7119f Fix 9323857 (again) 2014-03-13 19:07:50 +01:00
Bastien Guerry a6f8460487 Merge branch 'maint' 2014-03-13 09:46:58 +01:00
Bastien Guerry f94ed64ffd Fix 9323857
Thanks to Charles Berry for reporting this.
2014-03-13 09:46:45 +01:00
Bastien Guerry 4d835d719d Merge branch 'maint'
Conflicts:
	lisp/org.el
2014-03-12 19:14:03 +01:00
Arun Persaud 9323857411 org-src.el (org-edit-src-exit): Don't add indentation on empty lines
* org-src.el (org-edit-src-exit): Don't add indentation on
empty lines.

TINYCHANGE
2014-03-12 19:08:17 +01:00
Bastien Guerry f0e5683a12 org-src.el (org-edit-src-find-region-and-lang): Check if we are in a table.el table last
* org-src.el (org-edit-src-find-region-and-lang): Check if we
are in a table.el table last.

Thanks to zwz and Thomas Holst for reporting this.
2014-03-12 18:56:57 +01:00
Bastien Guerry 05cd942f31 Merge branch 'maint' 2014-02-09 14:54:23 +01:00
Bastien Guerry 0ceb68d599 org-src.el (org-edit-src-code): Throw a warning instead of an error
* org-src.el (org-edit-src-code): Throw a warning instead of
an error when loading the mode fails, otherwise the user is
left with unusable buffers.

Thanks to Florian Beck for suggesting this.
2014-02-09 14:54:12 +01:00
Bastien Guerry f8e1745440 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry 7d9a883b50 Update copyright years again.
Hint: copyright years are all updated in Emacs.
2014-01-07 14:18:17 +01:00
Bastien Guerry c41f5075ac Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry 0beda99171 Revert "Update copyright years."
This reverts commit 21105594fc.
2014-01-05 06:28:07 +01:00
Bastien Guerry 096ff7e078 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Bastien Guerry 21105594fc Update copyright years. 2014-01-04 18:56:11 +01:00
Bastien Guerry 9214000c21 Merge branch 'maint'
Conflicts:
	doc/org.texi
2013-11-17 09:17:39 +01:00
Bastien Guerry a6210cc9c2 Backport Paul's fixes from Emacs trunk (1/2)
See http://article.gmane.org/gmane.emacs.diffs/123123
2013-11-17 09:12:41 +01:00
Bastien Guerry 71884cc039 Merge branch 'maint'
Conflicts:
	lisp/ob-C.el
	lisp/ob-clojure.el
	lisp/ob-core.el
	lisp/ob-lisp.el
	lisp/org-clock.el
2013-11-12 21:00:49 +01:00
Bastien Guerry f95641c443 Backport changes from Emacs revs 115081 and 115082
2013-11-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	Address some byte-compiler warnings.
	* ob-abc.el (org-babel-expand-body:abc): Use dolist.
	(org-babel-execute:abc): Fix regexp quoting.
	* ob-calc.el (org--var-syms): Rename from `var-syms'.
	* ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding.
	* ob-table.el (sbe): Move debug declaration.
	* org-clock.el (org--msg-extra): Rename from `msg-extra'.
	* org.el (org-version): Avoid var name starting with _.
	(org-inhibit-startup, org-called-with-limited-levels)
	(org-link-search-inhibit-query, org-time-was-given)
	(org-end-time-was-given, org-def, org-defdecode, org-with-time):
	* org-colview.el (org-agenda-overriding-columns-format):
	* org-agenda.el (org-agenda-multi, org-depend-tag-blocked)
	(org-agenda-show-log-scoped):
	* ob-python.el (py-which-bufname, python-shell-buffer-name):
	* ob-haskell.el (org-export-copy-to-kill-ring):
	* ob-exp.el (org-link-search-inhibit-query):
	* ob-R.el (ess-eval-visibly-p):
	* ob-core.el (org-src-window-setup): Declare before use.
	(org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'.
	* ox-odt.el (org-odt-hfy-face-to-css):
	* org-src.el (org-src-associate-babel-session, org-src-get-lang-mode):
	* org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex)
	(org-bibtex-check):
	* ob-tangle.el (org-babel-tangle, org-babel-spec-to-string)
	(org-babel-tangle-single-block, org-babel-tangle-comment-links):
	* ob-table.el (sbe):
	* ob-sqlite.el (org-babel-sqlite-expand-vars):
	* ob-sql.el (org-babel-sql-expand-vars):
	* ob-shen.el (org-babel-execute:shen):
	* ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate):
	* ob-scala.el (org-babel-scala-evaluate):
	* ob-ruby.el (org-babel-ruby-table-or-string)
	(org-babel-ruby-evaluate):
	* ob-python.el (org-babel-python-table-or-string)
	(org-babel-python-evaluate-external-process)
	(org-babel-python-evaluate-session):
	* ob-picolisp.el (org-babel-execute:picolisp):
	* ob-perl.el (org-babel-perl-evaluate):
	* ob-maxima.el (org-babel-execute:maxima):
	* ob-lisp.el (org-babel-execute:lisp):
	* ob-java.el (org-babel-execute:java):
	* ob-io.el (org-babel-io-evaluate):
	* ob-haskell.el (org-babel-execute:haskell):
	* ob-fortran.el (org-babel-execute:fortran):
	* ob-exp.el (org-babel-exp-code):
	* ob-emacs-lisp.el (org-babel-execute:emacs-lisp):
	* ob-ditaa.el (org-babel-execute:ditaa):
	* ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash)
	(org-babel-parse-header-arguments, org-babel-reassemble-table)
	(org-babel-goto-src-block-head, org-babel-mark-block)
	(org-babel-expand-noweb-references, org-babel-script-escape)
	(org-babel-process-file-name):
	* ob-clojure.el (org-babel-execute:clojure):
	* ob-calc.el (org-babel-execute:calc):
	* ob-awk.el (org-babel-execute:awk):
	* ob-abc.el (org-babel-execute:abc):
	* ob-R.el (org-babel-expand-body:R):
	* ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...).

2013-11-12  Glenn Morris  <rgm@gnu.org>

	* ox-html.el (org-html-scripts): Add 2013 to copyright years.
	(org-html-infojs-template): Copyright holder to FSF.
2013-11-12 20:57:31 +01:00
Aaron Ecay 8b264d505e Fix org-src-edit interaction with undo.
* org-src.el (org-edit-src-exit): Place an undo boundary before
writing changes back to parent buffer.

The previous code attempted to preserve the undo information in the
indirect buffer editing the source code, but this interacts poorly
with the undo system, and can lead to undo operations scrambling the
buffer.  The new approach means that edits made in the indirect buffer
cannot be undone piece-by-piece (instead, all changes made in the
indirect buffer constitute one “change” from the point of view of
undo), but the misbehavior of undo is (hopefully) now avoided.
2013-10-28 15:09:25 -04:00
Bastien Guerry 0eb0e5778b Use bzg@gnu.org instead of bzg AT gnu DOT org 2013-10-08 08:07:21 +02:00
Carsten Dominik 4cd14bd2ff Protect src overlay during saving the src snipped
* lisp/org-src.el (org-edit-src-exit): Let overlay survive after the
buffer has been saved.
2013-09-25 09:14:12 +02:00
rasmus 6727f1aa75 Better C++ recognition
* ob-C.el: Added =C++= to =`org-babel-load-languages'=
automatically after loading =C=.
* org-src.el (org-src-lang-modes): Added association between
language =C++= and =`c++-mode'=.

=C++= is added to org-babel-load-languages to make
`org-babel-demarcate-block' recognize =C++= as a proper language.
2013-07-13 10:35:34 -06:00
Bastien Guerry 7790a97cdd org-src.el (org-edit-src-turn-on-auto-save): New option
* org-src.el (org-edit-src-turn-on-auto-save): New option.
(org-edit-src-code): Use it.
(org-edit-src-auto-save-idle-delay): Enhance docstring.

* doc/org.texi (Editing source code): Document
`org-edit-src-auto-save-idle-delay' and
`org-edit-src-turn-on-auto-save'.

Thanks to Charles C. Berry for bringing this up again.
2013-04-16 10:38:01 +02:00
Bastien Guerry 8c7e46b6a9 org-src.el (org-edit-src-code): Don't set `buffer-auto-save-file-name' unless `auto-save-default' is non-nil
* org-src.el (org-edit-src-code): Don't set
`buffer-auto-save-file-name' unless `auto-save-default' is
non-nil.

Thanks to Charles Berry for reporting this.
2013-04-07 22:43:02 +02:00
Bastien Guerry 9c8f4a53d7 org-src.el (org-src-native-tab-command-maybe): Check that we are in a source code block
* org-src.el (org-src-native-tab-command-maybe): Check that we
are in a source code block.

Consider this content:

#+HEADERS: :var data1=1
#+BEGIN_SRC emacs-lisp :var data2=2
  (message "data1:%S, data2:%S" data1 data2)
#+END_SRC

Before the fix, hitting TAB on #+HEADERS would throw an error.
2013-04-03 18:28:29 +02:00
Aaron Ecay 50226db65d org-src.el (org-edit-src-exit): Don't modify the undo list when inserting the code
* org-src.el (org-edit-src-exit): Don't modify the undo list when
inserting the code.
2013-03-08 18:31:14 +01:00
Achim Gratz 3773029db9 fix 17131cbf63
* lisp/ob-tangle.el (org-babel-tangle): Do not change signature, a nil
  arg is even documented in the manual.
* lisp/org-src.el: Change declaration of `org-babel-tangle´ to "arg"
  for first argument.
2013-03-02 18:13:52 +01:00
Bastien Guerry 463a2f602f org-src.el (org-edit-src-auto-save-idle-delay): Deactivate auto-saving by default
* org-src.el (org-edit-src-auto-save-idle-delay): Use a delay
of 0 by default (i.e., deactivate auto-saving.)
(org-edit-src-code): Set `buffer-auto-save-file-name' for
auto-saving with `auto-save-mode'.

Thanks to Andreas Leha for suggesting this.
2013-03-02 15:04:43 +01:00
Bastien Guerry 295b0ba5d1 Bump :version to "24.4" and add :package-version.
The options updated are those who won't be in Emacs 24.3.
2013-02-26 18:21:28 +01:00
Bastien Guerry c1cdb379af org-src.el: Use C-c C-k for `org-edit-src-abort'
* org-src.el (org-src-mode-map, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-save): Use C-c C-k
for `org-edit-src-abort'.

Thanks to Bernt Hansen for the suggestion.
2013-02-16 21:33:28 +01:00
Bastien Guerry 25aabd7d2f org-src.el (org-edit-src-auto-save-idle-delay): New option
* org-src.el (org-edit-src-auto-save-idle-delay): New option.
(org-src-ask-before-returning-to-edit-buffer): Make a defcustom.
(org-edit-src-code-timer): New timer variable.
(org-edit-src-code): Run the timer.
(org-edit-fixed-width-region): Enhance message.
(org-edit-src-exit): Cancel the timer.

Thanks to Andreas Leha for suggesting this.
2013-02-16 11:35:39 +01:00