Commit Graph

106 Commits

Author SHA1 Message Date
Nicolas Goaziou ce2090ccfd Fix indentation in lists
* lisp/org-list.el (org-list-item-body-column): Take into
  consideration empty items and bullets followed by two spaces.

* lisp/org.el (org--get-expected-indentation): Fix return value for
  items in lists.
(org-indent-region): Fix infloop when indenting some types of plain
lists.  Also fix error when region starts with blank lines at the
beginning of the buffer.

* testing/lisp/test-org.el (test-org/indent-region): Add tests.
2014-10-13 19:03:14 +02:00
Nicolas Goaziou 0620fe98cb Merge branch 'maint' 2014-09-19 21:03:27 +02:00
Nicolas Goaziou 3f484a5277 Fix headline insertion after an empty headline
* lisp/org.el (org-N-empty-lines-before-current): Make sure to delete
  only empty lines, not trailing whitespaces.

* testing/lisp/test-org.el (test-org/insert-heading): Add test.

Thanks to Oleh for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/90876
2014-09-19 20:59:40 +02:00
Nicolas Goaziou c8a7e474ec Fix `org-hide-block-toggle' return value
* lisp/org.el (org-hide-block-toggle-maybe): Do not return a non-nil
  value when toggling failed.
(org-hide-block-toggle): Update docstring.

* testing/lisp/test-org.el (test-org/hide-block-toggle-maybe): New
  test.
2014-09-16 09:29:28 +02:00
Nicolas Goaziou cdb85242d6 Fix block hiding
* lisp/org.el (org-hide-block-toggle): Correctly find boundaries of
  the block at point.  Fix `off' argument behavior.  Allow to hide
  a block when at any affiliated keyword.

* testing/lisp/test-org.el (test-org/hide-block-toggle): New test.

Thanks to Andrea Rossetti for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/89324
2014-08-01 10:50:36 +02:00
Achim Gratz 547f6ee541 Fix 1f3fefcba5
* testing/lisp/test-org.el: The title of the Emacs manual is "The Emacs Editor".
2014-07-29 21:55:47 +02:00
Bastien Guerry 1f3fefcba5 test-org.el: Test info link using Emacs info documentation
* test-org.el (test-org/open-at-point-in-property)
(test-org/open-at-point-in-comment)
(test-org/open-at-point/info): Test info link using Emacs info
documentation.
2014-07-27 15:42:28 +02:00
Nicolas Goaziou c9eaea360a Fix `org-drag-element-backward'
* lisp/org.el (org-drag-element-backward): Correcly drag elements in
  a drawer or a block.
* testing/lisp/test-org.el (test-org/drag-element-backward): Add test.
2014-06-25 10:49:52 +02:00
Nicolas Goaziou 5cca90edf8 Merge branch 'maint'
Conflicts:
	lisp/org.el
	testing/lisp/test-org.el
2014-06-09 18:11:19 +02:00
Nicolas Goaziou 8cc4e09950 Fix `org-insert-heading' before first headline
* lisp/org.el (org-insert-heading): Fix error when inserting
  a headline before first headline, with point not at bol.  Remove
  source block check for consistency with behavior after first
  headline.  Tiny fix to docstring.

* testing/lisp/test-org.el (test-org/meta-return): Remove unnecessary
  test (not testing specifications).
(test-org/insert-heading): New test.
2014-06-09 18:07:07 +02:00
Bastien Guerry ad567e877b testing/lisp/test-org.el: Update tests
* testing/lisp/test-org.el
(test-org/open-at-point-in-property): Rename from
`test-org/open-at-point'.  Only test whether
`org-open-at-point' does not throw an error.
(test-org/open-at-point-in-comment)
(test-org/open-at-point/info): New tests.
2014-06-02 22:33:28 +02:00
Achim Gratz 8e72c8fcfa testing/lisp/test-org: actually check that org-open-at-point did the right thing
* testing/lisp/test-org.el (test-org/open-at-point): The test should
  leave the cursor one line above "Org Mode Manual" in the "*info*"
  buffer.  Try to switch to that buffer and check that point is where
  it should be, then kill the buffer.
2014-06-02 21:05:46 +02:00
Nicolas Goaziou 7dadf85716 Move test into appropriate file
* testing/lisp/test-org-element.el (test-org-element/org-open-at-point):
Remove test.
* testing/lisp/test-org.el (test-org/open-at-point): Add test.
2014-06-01 13:37:11 +02:00
Nicolas Goaziou f58201b1e1 Fix indentation in source blocks
* lisp/org.el (org-indent-line): Indent source block contents
  according to line above when `org-src-tab-acts-natively' is nil.

* testing/lisp/test-org.el (test-org/indent-line): Update test.
2014-05-19 13:33:28 +02:00
Nicolas Goaziou 3702dce1db Fix previous patch
* lisp/org.el (org-update-radio-target-regexp): Fix previous patch.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Add test.
2014-05-17 11:14:27 +02:00
Nicolas Goaziou f8b7eb4e20 Fix radio target update
* lisp/org.el (org-update-radio-target-regexp): Properly update cache
  when refreshing regexp.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Fix
  test.
2014-05-17 11:03:29 +02:00
Nicolas Goaziou 49ef55bd65 test-org: Fix test name
* testing/lisp/test-org.el (test-org/toggle-fixed-width): Fix test
  name.
2014-05-16 22:14:59 +02:00
Nicolas Goaziou fe129fb352 Rewrite `org-indent-region'
* lisp/org.el (org-indent-region): Update function according to recent
  `org-indent-line' change.  Optimize it.

* testing/lisp/test-org.el (test-org/indent-region): New test.
2014-05-07 17:39:52 +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
Nicolas Goaziou 86a129c597 Fix `org-flag-drawer'
* lisp/org.el (org-flag-drawer): Do not flag drawer when point is on
  an empty line after it.  When hiding the drawer away, make sure
  point always stays in a visible part of the buffer.

* testing/lisp/test-org.el (test-org/flag-drawer): Add tests.
2014-04-28 19:41:08 +02:00
Bastien Guerry 69700e1c44 Merge branch 'maint' 2014-04-22 12:09:01 +02:00
Bastien Guerry 099b6f0fb5 test-org.el: Fix test
* test-org.el (test-org/insert-todo-heading-respect-content):
Fix test.
2014-04-22 12:08:15 +02:00
Nicolas Goaziou 82cc4f43ec test-org: Tiny clean-up
* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Tiny
  clean-up.
2014-04-19 20:27:21 +02:00
Nicolas Goaziou 6eb940a8dc Fix cache update when radio targets are being refreshed
* lisp/org-element.el (org-element-cache-refresh): New function.
* lisp/org.el (org-update-radio-target-regexp): Make it standalone.
  Also refresh fontification only when necessary.
(org-all-targets, org-make-target-link-regexp): Remove functions.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): New
  test
(test-org/all-targets): Remove test.

We need to manually reset cache on radio links as re-fontification
doesn't trigger a buffer change, and, as a consequence, a cache reset.
2014-04-19 18:36:58 +02:00
Nicolas Goaziou fea23d3da2 Fix COMMENT keyword when stacked with a regular keyword
* lisp/org.el (org-set-font-lock-defaults): Fix headline fontification
  when keywords are stacked.
(org-toggle-comment): Properly toggle COMMENT keyword when a regular
keyword is already present.
(org-todo, org-agenda-prepare-buffers): Correctly match a commented
heading.
* lisp/org-colview.el (org-columns-capture-view): Correctly match
  a commented heading.

* testing/lisp/test-org.el (test-org/toggle-comment): New test.
2014-04-10 22:51:16 +02:00
Nicolas Goaziou 6d1d61f667 Rename `org-babel-under-commented-heading-p'
* lisp/org.el (org-in-commented-heading-p): New function.
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Remove
  function.
(org-babel-tangle-collect-blocks): Use new function.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Use new function.

* testing/lisp/test-org.el (test-org/in-commented-heading-p): New
  test.
2014-03-24 13:29:42 -04:00
Nicolas Goaziou d6d1f25429 Fix `org-open-at-point'
* lisp/org.el (org-open-at-point): Correctly open fuzzy links when
  path is hexified.
* testing/lisp/test-org.el (test-org/coderef): New test.
(test-org/fuzzy-links): Add test.
2014-03-21 14:51:34 +01:00
Nicolas Goaziou d75fa9febc `org-open-at-point' right after an object still open it
* lisp/org.el (org-open-at-point): White spaces after an object are
  usually ignored by the function.  Though, when point is right after
  the object, still activate it.
* testing/lisp/test-org.el (test-org/custom-id): Fix test.
2014-03-02 10:32:51 +01:00
Nicolas Goaziou 8b2d3645ac Ignore `org-open-at-point' when point is on white spaces
* lisp/org.el (org-open-at-point): Do not do anything when point is on
  white spaces after an object.
* testing/lisp/test-org.el (test-org/custom-id): Modify test.
2014-02-27 18:38:39 +01:00
Nicolas Goaziou fc9ce86cfc Rewrite `org-open-at-point' using Elements
* lisp/org.el (org-open-at-point): Rewrite function using Element
  parser.
(org-link-types): Add "help" type.
* testing/lisp/test-org-open-at-point.el: Remove file.  Two tests are
  not supported anymore (namely bracket-link-before and
  plain-link-before) and the other tests are wrong (mixing id and
  custom-id links).
* testing/examples/open-at-point.org: Remove file.
* testing/lisp/test-org.el (test-org/custom-id): Add test.

Unlike to the previous implementation, this one will only open links
under point or just before point, not links on the same line but
before point.
2014-02-23 14:26:18 +01:00
Michael Brand 54e3009d73 Fix escaping of more links in HTML export
* lisp/org.el (org-link-escape-chars): Extend docstring.
(org-link-escape-chars-browser): Mention in docstring that it will
become a candidate for removal.
(org-link-escape-browser): Mention in docstring that it will become a
candidate for removal.
(org-open-at-point): Move `url-encode-url' and comments into
`org-link-escape-browser'.

* lisp/ox-html.el (org-html-link): Make use of
`org-link-escape-browser' like `org-open-at-point'.

* testing/lisp/test-org.el (test-org/org-link-escape-chars-browser):
Mention in docstring that it will become a candidate for removal.
2014-02-19 20:49:21 +01:00
Nicolas Goaziou b8665a0190 New function to toggle fixe-width areas
* lisp/org.el (org-toggle-fixed-width): New function.
* testing/lisp/test-org.el (test-org/toggle-fixed-with): New test.

This replaces the old implementation removed in commit
6a00c96541.
2014-02-06 18:55:14 +01:00
Nicolas Goaziou 28f4b89830 Small refactoring in comment functions
* lisp/org.el (org-insert-comment, org-comment-or-uncomment-region):
  Use `org-element-at-point' instead of `org-in-src-block-p' to check
  if we're within a source block.
* testing/lisp/test-org.el: Add test.
2013-11-04 18:13:55 +01:00
Nicolas Goaziou b392750108 Prevent flagging drawers in example blocks
* lisp/org.el (org-flag-drawer): Rewrite function using Elements.
  Also prevents flagging drawers within example blocks.
* testing/lisp/test-org.el (test-org/flag-drawer): Add test.
2013-11-02 15:50:29 +01:00
Nicolas Goaziou 6202ec7b3b Remove need to declare drawers before using them
* lisp/org-agenda.el (org-agenda-prepare): Remove reference to
  `org-drawers-for-agenda'.
(org-agenda-show-1): Remove reference to `org-drawers'.
* lisp/org-clock.el (org-clock-remove-empty-clock-drawer,
  org-clock-cancel): Apply signature change to
  `org-remove-empty-drawer-at'.
* lisp/org-element.el (org-element--list-struct): Use
  `org-drawer-regexp' instead of `org-drawers'.
* lisp/org-feed.el (org-feed-drawer): Update docstring according to
  change.
* lisp/org-list.el (org-in-item-p, org-list-context): Use
  `org-drawer-regexp' instead of `org-drawers'.
* lisp/org-mobile.el (org-mobile-create-index-file): Remove reference
  to `org-drawers-for-agenda'.
* lisp/org-pcomplete.el (pcomplete/org-mode/drawer): Remove function.
* lisp/org.el (org-drawer-regexp): Make variable global.
(org-drawers): Remove variable.
(org-set-regexps-and-options): Ignore DRAWER keyword.
(org-cycle): Use `org-drawer-regexp' instead of `org-drawers'.
(org-cycle-hide-drawers): Add an optional argument to ignore some
drawers.
(org-remove-empty-drawer-at): Remove second argument.  Rewrite
function.
(org-clone-subtree-with-time-shift): Apply signature change to
`org-remove-empty-drawer-at'.
(org-toggle-ordered-property): Apply `org-delete-property' signature
change.
(org-map-entries): Remove reference to `org-drawers-for-agenda'.
(org-entry-delete): Remove optional argument.  Small refactoring.
(org-insert-drawer): Remove reference to `org-drawers'.
(org-delete-property): Apply `org-entry-delete' signature change.
(org-in-drawer-p): Rewrite function.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-org.el: Update tests.
* testing/lisp/test-ox.el: Update tests.
2013-10-31 21:19:40 +01:00
Nicolas Goaziou 0be044736c Merge branch 'maint' 2013-10-29 09:57:48 +01:00
Nicolas Goaziou a7e5a74e2c Fix `org-insert-heading' at buffer boundaries
* lisp/org.el (org-insert-heading): Do not error out when inserting is
  to be done at one of the buffer's boundaries.
* testing/lisp/test-org.el: Add tests.
2013-10-29 09:55:01 +01:00
Michael Brand e04a22ed2d Small improvement of maintainability of link escaping
* lisp/org.el (org-link-escape-chars): Add comment with escape numbers
alphabetically ordered.
(org-link-escape-chars-browser): Add comment with escape numbers.
(org-link-escape): Use better readable char constant instead of number
constant for percent char.
(org-link-escape-browser): New function to substitute duplicate source
code.
(org-open-at-point): Substitute duplicate source code.
* testing/README: Make comment in source code example clearer.
* testing/lisp/test-org.el (test-org/org-link-escape-chars-browser):
Change URL to real use case and use the new function
`org-link-escape-browser'.
2013-10-17 06:59:00 +02:00
Nicolas Goaziou 43733e33b1 New functions for paragraph-like navigation
* lisp/org.el (org-forward-paragraph, org-backward-paragraph): New
  functions.
* testing/lisp/test-org.el: Add tests.
2013-09-14 00:23:54 +02:00
Michael Brand 8e07014036 Add ERTs for org-meta-return
* testing/lisp/test-org.el (test-org/meta-return): New `ert-deftest'
to test `org-meta-return'.
2013-09-12 22:57:07 +02:00
Nicolas Goaziou 2e3f5558d7 Do not handle `adaptive-fill-regexp' in comments
* lisp/org.el (org-adaptive-fill-function): Do not handle
  `adaptive-fill-regexp' in comments as the behaviour is not
  satisfying.
* testing/lisp/test-org.el: Remove test.
2013-09-06 12:32:13 +02:00
Nicolas Goaziou 54431e2a5b Merge branch 'maint' 2013-08-22 21:55:51 +02:00
Nicolas Goaziou 9e51049b22 Fix filling with `adaptive-fill-regexp'
* lisp/org.el (org-adaptive-fill-function): Look for a fill prefix at
  the beginning of the paragraph and subsquently on its second line
  instead of the current line.
* testing/lisp/test-org.el: Add test
2013-08-22 21:54:52 +02:00
Nicolas Goaziou aef1b17773 Merge branch 'maint' 2013-07-28 10:17:17 +02:00
Nicolas Goaziou 36161345d1 Reintroduce support for `adaptive-fill-regexp' in paragraphs and comments
* lisp/org.el (org-adaptive-fill-function, org-fill-paragraph): Add
  support for `adaptive-fill-regexp' in paragraphs and comments.
* testing/lisp/test-org.el: Add tests.
2013-07-28 10:16:03 +02:00
Nicolas Goaziou 5074999605 Merge branch 'maint' 2013-07-10 14:14:18 +02:00
Nicolas Goaziou 136081a0d4 Use empty commented lines as separators when filling comments
* lisp/org.el (org-fill-paragraph): Use empty commented lines as
  separators when filling comments.  This mimics default behaviour
  from "newcomment.el", which is not used in Org.
* testing/lisp/test-org.el: Add tests.
2013-07-10 14:13:39 +02:00
Nicolas Goaziou d5c11e6b5a Merge branch 'maint' 2013-07-09 13:53:36 +02:00
Nicolas Goaziou c78fa35252 Fix error when filling consecutive comments
* lisp/org.el (org-fill-paragraph): Do not mix consecutive comments
  when filling any of them.
* testing/lisp/test-org.el: Add test.

Thanks to Samuel Wales for reporting it.
2013-07-09 13:52:00 +02:00
Michael Brand 9998f2c897 Escape double quotes in URL passed to browse-url
Escape double quotes in URL passed to browse-url

* lisp/org.el (org-link-escape-chars-browser): Add char double quote.
* lisp/org.el (org-open-at-point): Make use of the constant
`org-link-escape-chars-browser'.
* testing/lisp/test-org.el
(test-org/org-link-unescape-ascii-extended-char): Fill paragraph.
(test-org/org-link-escape-url-with-escaped-char): Fill paragraph and
typo.
(test-org/org-link-escape-chars-browser): New test.

This is to make work to open the Org link
[[http://some.host.com/search?q="Org mode"]] in a browser.

From 28726bcc7b7c440d70e2d95ea5a61d0cd5f084ea Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Sun, 5 May 2013 17:02:18 +0200
Subject: [PATCH] Escape double quotes in URL passed to browse-url

* lisp/org.el (org-link-escape-chars-browser): Add char double quote.
* lisp/org.el (org-open-at-point): Make use of the constant
`org-link-escape-chars-browser'.
* testing/lisp/test-org.el
(test-org/org-link-unescape-ascii-extended-char): Fill paragraph.
(test-org/org-link-escape-url-with-escaped-char): Fill paragraph and
typo.
(test-org/org-link-escape-chars-browser): New test.

This is to make work to open the Org link
[[http://some.host.com/search?q="Org mode"]] in a browser.
2013-05-05 18:12:53 +02:00