1183 Commits

Author SHA1 Message Date
João Távora
6053db05ca Closes #527: Unbreak case where yas-fallback-behaviour is a list
* yasnippet.el (yas--fallback): Extract interesting values from
`yas-fallback-behaviour' before rebinding.
2014-10-09 07:16:36 +01:00
João Távora
70151f4f1e Closes #525, closes #526: Prevent some keybinding fallback loops
* yasnippet.el (yas--keybinding-beyond-yasnippet): Add docstring.
(yas--fallback): Also let-bind `yas-minor-mode' to nil when
falling back.
2014-10-07 14:57:23 +01:00
João Távora
6877bc6db3 Merge pull request #524 from npostavs/fallback-loop
Signal an error on recursive yas--fallback calls
2014-10-05 09:24:34 +01:00
Noam Postavsky
e7314516e3 Signal an error on recursive yas--fallback calls
* yasnippet.el (yas--fallback): let-bind yas-fallback-behavior to
  'yas--fallback before actually doing the fallback. Signal an error if
  it's 'yas--fallback (indicating we're in an infinte loop).
2014-10-04 20:52:58 -04:00
João Távora
08b044e559 Merge pull request #519 from syohex/use-cl-macro 2014-09-29 10:40:07 +01:00
Syohei YOSHIDA
783cc3394f Use cl-incf instead of cl
* yasnippet.el (yas--snippet-next-id, yas--real-line-beginning):
Use `cl-incf'.
2014-09-29 10:38:31 +01:00
João Távora
8e9bf3cdb4 Merge pull request #518 from rnkn/master
Compatibility with custom-unlispify-remove-prefixes
2014-09-22 22:02:00 +01:00
Paul Rankin
6f7c91558a Compatibility with custom-unlispify-remove-prefixes 2014-09-21 00:53:29 +10:00
João Távora
41cb5f565f Update snippets submodule 2014-09-11 11:12:19 +01:00
João Távora
cc64ff62bf Merge pull request #514 from tarsius/master
Cosmetic fixes and quiet byte-compiler
0.9.0-beta
2014-09-09 20:50:56 +01:00
Jonas Bernoulli
70de82164c enforce use of spaces for indentation 2014-09-07 14:20:07 +02:00
Jonas Bernoulli
37df653a67 yasnippet-debug.el: quiet byte-compiler 2014-09-07 14:20:07 +02:00
Jonas Bernoulli
241465cea2 move eof footer to the actual eof 2014-09-07 14:20:07 +02:00
João Távora
be2f815c43 Closes #508: Ensure original point when evaluating conditions
* yasnippet.el (yas--templates-for-key-at-point): Call
`yas--fetch', and hence condition system, with point in the
original position.
0.9.0-a
2014-08-21 08:38:46 +01:00
João Távora
5b59b802ac Closes #495: Allow symbols as aliases in `yas-snippet-dirs'
* yasnippet.el (yas-installed-snippets-dir): New parameter. Set at
load time from `load-file-name'.
(yas--load-file-name): Removed.
(yas-snippet-dirs): Update docstring. Default value has symbol
`yas-installed-snippets-dir' as an alias to any bundled snippets.
(yas-snippet-dirs): Redesign for new `yas-snippet-dirs' semantics.
2014-08-20 21:48:41 +01:00
João Távora
1d4618b022 Closes #504: Correctly discover buffers needing snippets immediately
* yasnippet-tests.el (issue-504-tricky-jit): New test.

* yasnippet.el (yas-load-directory): Use a new `impatient-buffers'
local and call `yas--load-pending-juts' in all those at the end.

* yasnippet.el (cl-lib): Don't need `eval-and-compile'.
2014-08-20 21:29:32 +01:00
João Távora
f7ef023ebb Prevent disabling errors from recent yas-current-syntaxes logic
* yasnippet.el (yas--templates-for-key-at-point): Don't error
since this function is called very frequently on TAB. Use new
`yas--warning'.
(yas--warning): New function.
2014-08-20 20:23:00 +01:00
João Távora
e60e8b5551 Merge pull request #503 from npostavs/key-syntaxes
More yas-key-syntaxes functions
2014-08-11 00:26:29 +01:00
Noam Postavsky
d982b701fc Fix edge case in yas-longest-key-from-whitespace
* yasnippet.el (yas-longest-key-from-whitespace): don't try again if
  start-point is on whitespace.
* yasnippet-tests.el (complicated-yas-key-syntaxes): check edge case.
2014-08-10 14:05:26 -04:00
Noam Postavsky
47a3d5f1cb Fix yas-key-syntaxes example functions docstrings.
* yasnippet.el (yas-try-key-from-whitespace),
  (yas-shortest-key-until-whitespace),
  (yas-longest-key-from-whitespace): docstring describes the effect, not
  implementation.
2014-08-10 14:05:26 -04:00
Noam Postavsky
5d10b5dfee Add yas-longest-key-from-whitespace
Example yas-key-syntaxes function.

* yasnippet.el (yas-longest-key-from-whitespace): new function.
* yasnippet-tests.el (complicated-yas-key-syntaxes): test it.
2014-08-10 14:05:25 -04:00
Noam Postavsky
10ecde158e Pass start point to yas-key-syntaxes functions
* yasnippet-tests.el (complicated-yas-key-syntaxes): accept argument.
* yasnippet.el (yas-try-key-from-whitespace): accept argument.
  (yas-shortest-key-until-whitespace): accept argument.
  (yas--templates-for-key-at-point): pass start point the methods.
  (yas-key-syntaxes): update docstring.
2014-08-10 14:05:25 -04:00
Noam Postavsky
280ece2af4 Add yas-shortest-key-until-whitespace
Example yas-key-syntaxes function.

* yasnippet.el (yas-shortest-key-until-whitespace): new function.
* yasnippet-tests.el (complicated-yas-key-syntaxes): test it.
2014-08-10 14:05:25 -04:00
Noam Postavsky
de34d91a3c Closes #470, handle non-whitespace newlines
Many modes put newlines in comment ender class because they have line
comments.

* yasnippet.el (yas-try-key-from-whitespace): new function.
(yas-key-syntaxes): use it in place of "^ ".
* yasnippet-tests.el (complicated-yas-key-syntaxes): test it.
2014-08-10 14:05:01 -04:00
João Távora
faed1062a2 * yasnippet.el (yas-key-syntaxes): Improve documentation. 2014-07-29 20:40:09 +01:00
João Távora
7761deeeb5 Closes #497: Allow functions as elements in yas-key-syntaxes
* yasnippet.el (yas--templates-for-key-at-point): Renamed from
`yas--current-key'.
(yas-key-syntaxes): Overhaul documentation.
(yas-expand-from-trigger-key): Use
`yas--templates-for-key-at-point'.

* yasnippet-tests.el (complicated-yas-key-syntaxes): New test.
(yas-should-expand, yas-should-not-expand): Friendlier failure
message.
2014-07-29 01:19:58 +01:00
João Távora
0b7b34a333 Closes #492, closes #494: Consider defalias when calculating parent modes
* yasnippet-tests.el (issue-492-and-494): New test.

* yasnippet.el (yas--modes-to-activate): Consider each mode's
symbol-function as a neighbour in case it's a symbol as well.
2014-07-28 23:23:04 +01:00
João Távora
2b24aeaf80 Merge pull request #493 from npostavs/ijit
Allow jit loading interactively
2014-07-20 23:34:00 +01:00
Noam Postavsky
e1ed662b7c Allow jit loading interactively
* yasnippet.el (yas-reload-all, yas-load-directory): let a prefix
  argument indicate jit loading.
2014-07-19 10:47:48 -04:00
Noam Postavsky
e53ec1e0c3 Make snippets submodule track master, update it
This should let us update the submodule just by running
    git submodule update --remote
rather than having to cd into it, and then pull.
2014-06-17 19:40:55 -04:00
Noam Postavsky
f98c527a38 Replace text -> yas-text in documentation
* doc/snippet-development.org: replace text -> yas-text
2014-06-17 19:21:22 -04:00
Noam Postavsky
763f5faa14 Closes #474: fix more cc-mode font-lock conflicts
* yasnippet-tests.el (example-for-issue-474): Don't call insert from
  within backquotes, it's redundant and prevents proper testing of
  backquote expansion.

* yasnippet.el (yas--restore-backquotes, yas--save-backquotes): Ensure
  the buffer isn't narrowed while modifying it to avoid conflicting with
  cc-mode fontification.
2014-05-14 19:49:11 -04:00
Noam Postavsky
fe288a156c Fix publishing with org 7.9
* doc/yas-doc-helper.el: Only use org-html-publish-to-html when it's
  fbound.
2014-05-11 19:37:12 -04:00
Noam Postavsky
6b04dada67 Document type directive
* doc/snippet-development.org: Add type to directive list.
2014-05-11 19:02:43 -04:00
Noam Postavsky
4c16eaee0e Document uuid directive
* doc/snippet-development.org: Mention uuid in directive list.
* yasnippet.el (yas-define-snippets): Fix docstring grammar.
2014-05-11 12:47:15 -04:00
Noam Postavsky
f1760272e0 Restore backquotes lost in rst -> org translation
* doc/snippet-development.org: Re-add lost `s.
2014-05-11 12:47:15 -04:00
Noam Postavsky
8ced5c7f1d Remove type, expand-env from new snippet value
They are seldom used, and can cause errors if left in.

* yasnippet.el (yas-new-snippet-default): Remove type and expand-env
  directives.
2014-05-11 12:44:29 -04:00
Noam Postavsky
580e5c64f6 Don't lose error message when yas-good-grace is t
* yasnippet.el
  (yas--eval-lisp-no-saves): Pass error message to message function.
  (yas--handle-error): Pass "%s" to error to avoid accidentally
  interpreting % in the error message as format codes.
2014-05-11 12:23:40 -04:00
Noam Postavsky
a80033d142 Refactor yas-good-grace error handling
* yasnippet.el
(yas--handle-error): New function.
(yas--eval-lisp-no-saves, yas--eval-lisp): Use it.
2014-05-10 23:04:13 -04:00
João Távora
4ccf133d49 Merge pull request #476 from npostavs/cc-fontify2
Avoid changing buffer while narrowed
2014-04-27 20:24:12 +01:00
Noam Postavsky
599a2622c6 Closes #474: fix cc-mode fontification conflict
* yasnippet.el (yas--save-backquotes): don't change buffer while
narrowed.
2014-04-27 14:49:05 -04:00
Noam Postavsky
4473b4ede5 New test for cc-mode's fontification functions
This issue requires font locking to trigger. This can be be done by
let-binding noninteractive to nil and using a buffer name that doesn't
start with a space, instead of the external emacs hack which is now
redundant.

* yasnippet-tests.el (yas--with-font-locked-temp-buffer): new macro
similar to with-temp-buffer but enables font-lock-mode even in -batch
mode.
(example-for-issue-474): new test
(example-for-issue-404, example-for-issue-404-c-mode): use new macro
(example-for-issue-404-external-emacs): removed
2014-04-27 14:49:02 -04:00
João Távora
4d9eee93ba Simpler, more effective .travis file
* .travis.yml (env): New section.
(install): Simpler install recipes.
(script): Just rake compile and rake tests.
2014-04-27 01:57:50 +01:00
João Távora
a0c221725c Merge pull request #473 from npostavs/org8
update doc for org 8.x
2014-03-24 00:29:14 +00:00
Noam Postavsky
a4e04f954b update doc for org 8.x
Keeping compabitily with 7.9 for now
2014-03-23 19:44:35 -04:00
Joao Tavora
8e7295b934 Closes #403: more uniform behaviour for `yas-use-menu'
Suggested by Noam Postavsky, this uses the :visible arg to
`easy-menu-define' to hide the whole "YASnippet" menu according to the
run-time value of `yas-use-menu'. Previously, only the load-time value
was considered and some functions we're noops when `yas-use-menu' was
nil.

The per-mode snippet submenus are now always updated even if
`yas-use-menu' is nil, although they won't be shown until it becomes
non-nil.

* yasnippet.el (yas--minor-mode-menu): Use :visible arg and eval `yas-use-menu'
(yas--update-template): Always update the menu.
(yas--show-menu-p): Always return t if `yas-use-menu' is non-nil and not `abbreviate'
(yas-define-menu): Always define a menu.
(yas-use-menu): Update docstring.
2014-03-14 09:55:22 +00:00
João Távora
b36a4f7449 Properly closes #469: Don't use `yas--init-minor-keymap'
Previous reverted commit 498cbe4 forgot to take into account that one
of the tests used the `yas--init-minor-keymap' function that was
removed.

* yasnippet.el (yas-use-menu): Don't allow `nil' value, it's
useless.
(yas--minor-mode-menu): Use top-level `easy-menu-define' form.
(yas--init-minor-keymap): Remove definition.

* yasnippet-tests.el (test-rebindings): Don't use
`yas--init-minor-keymap'. Restore bindings explicitly. Not ideal,
but should work.
2014-03-13 20:29:06 +00:00
Joao Tavora
d809e886e0 Revert "Closes #469: Don't use `yas--init-minor-keymap'"
This reverts commit 498cbe4138d74f39f7447acc9de456291c639724.
2014-03-13 20:23:05 +01:00
Joao Tavora
498cbe4138 Closes #469: Don't use `yas--init-minor-keymap'
* yasnippet.el (yas-use-menu): Don't allow `nil' value, it's
useless.
(yas--minor-mode-menu): Use top-level `easy-menu-define' form.
(yas--init-minor-keymap): Remove definition.
2014-03-13 19:04:05 +00:00
João Távora
e7599b9325 Merge pull request #466 from npostavs/no-reverse
Avoid double choices reversing
2014-03-06 08:05:53 +00:00