When inserting text due to a non-nil yas-wrap-around-region and the
snippet had fields occuring later in the buffer than $0, the insertion
of the text was shifting the location of later fields, thus invalidating
the calculation of yas--dollar-regions.
* yasnippet.el (yas--simple-mirror-parse-create): Don't insert text fo
yas-wrap-around-region here.
(yas--snippet-parse-create): Do it here, after deleting
`yas--dollar-regions`, instead.
Disabling this for trigger key introduced an inconsistency that is more
complicated to implement and document than simply fixing region wrapping
for trigger key expanded snippets.
Noam Postavsky [Thu, 10 Dec 2015 04:15:39 +0000 (23:15 -0500)]
Add register option for yas-wrap-around-region
Replace `cua' setting with more general behaviour that can use any given
register. A `cua' setting is converted to ?0 for backwards
compatibility.
* yasnippet.el (yas--simple-mirror-parse-create): Use contents of any
register depending on `yas-wrap-around-region' value.
(yas-wrap-around-region): Update docstring.
João Távora [Fri, 4 Mar 2016 17:34:40 +0000 (17:34 +0000)]
Indent multi-line output from mirrors
* yasnippet.el (yas--indent-region): Adapted and redesigned from
`yas--indent-according-to-mode'
(yas--indent-according-to-mode): Deleted.
(yas--indent): Use `yas--indent-region'.
(yas--real-line-beginning): Deleted.
(yas--update-mirrors): Always re-place active field overlay if it
exists. Pass the snippet to `yas--mirror-update-display'.
(yas--mirror-update-display): Indent the mirror text after
inserting the reflection.
* dired-async.el (dired-async-operation): Removed no more needed.
(dired-async-failures): New face.
(dired-async-mode-line-message): Use one more arg FACE.
(dired-async-after-file-create): Handle failures.
(dired-async-create-files): Pass failures args to callback.
Remove code that is now never called since when the mode is turned off
and we are no more async the job is delegated again to old dired function.
* async-bytecomp.el (async-byte-recompile-directory): Do it.
* dired-async.el (dired-async-create-files): Do it.
* smtpmail-async.el (async-smtpmail-send-it): Do it.
cc-mode fill paragraph narrows to the paragraph being filled. This
causes problems if there is a mirror needing to be updated outside of
the current paragraph.
* yasnippet-tests.el: New test.
* yasnippet.el (yas--update-mirrors): Widen while updating the mirrors.
(ampc-current-playlist-mode): Set font-lock-defaults instead.
(ampc-item-mode): Remove broken highlight rule.
(ampc-handle-status): Use font-lock-flush when available.
Stefan Monnier [Wed, 27 Apr 2016 13:39:46 +0000 (09:39 -0400)]
* debbugs: Use cl-lib. Use lexical-binding when available
* debbugs-gnu.el: Only require subr-x at compile time. Use cl-lib.
(debbugs-gnu-print-entry): Remove unused var `title-length'.
(debbugs-gnu-sort-title): Mark `s2' as unused.
* debbugs-org.el (debbugs-gnu): Use cl-lib.
* debbugs.el: Add `cl-lib' as dependency. Use cl-lib.
(debbugs-soap-invoke-async): Mark `args' as unused.
* packages/debbugs/debbugs-gnu.el (debbugs-gnu-patches): New command.
(debbugs-gnu-get-bugs): Remove the "user tags" cond -- it didn't
allow us to search for bugs with specific tags.
* packages/debbugs/debbugs-gnu.el (debbugs-gnu-insert-changelog):
When handling git-formatted patches, get all the info from the
patches automatically.
* .travis.yml: Don't use sudo, submodules.
(env): Test with additional Emacs versions.
(install): Get Emacs binaries from
https://github.com/npostavs/emacs-travis/releases. Download ert and
cl-lib if needed.
(script): Split compilation and testing into separate steps.
* Rakefile: Use batch-byte-compile. Treat compilation warnings as
errors.
In [1] we started deciding clearing based on a command's
delete-selection property, but it turns out that some commands perform
insertion, and optionally use the region's contents. So these commands
should have a nil delete-selection property, but they still ought to
clear a snippet field when used.
To achieve this, we now check if the command has inserted text in the
post-change hook of the field overlay.
* yasnippet.el (yas--skip-and-clear): Add optional FROM paramter. Only
clear non-empty fields.
(yas--skip-and-clear-field-p): Check the change start and length
instead of current command delete-selection property.
(yas--on-field-overlay-modification): Perform field clearing on the
post-change call.
[1]: acf2cdd "Decide field clearing commands based on delsel"
* dired-async.el (dired-async-create-files):
When using a file-creator named 'backup-file, files are
copied to destination without overwriting existing files,
making a versionned copy of original files.
Oleh Krehel [Fri, 22 Apr 2016 08:39:08 +0000 (10:39 +0200)]
Add a couple tests for ivy-read with alists
* ivy-test.el (ivy-read): Add tests.
To summarize how it works:
1. Only the keys of the alist are offered for completion, not the values
- this is the standard Emacs behavior.
2. `ivy-read' will return the selected key, not the value or the cons
cell.
3. When :action is specified, it will be called with the value
corresponding to the selected key. Not the key, and not the cons.
This allows keys to work as aliases for the actual data, and :action
arguments to be simple functions that deal with data (i.e. not having to
deal with the `cdr' of the passed argument).
Oleh Krehel [Mon, 18 Apr 2016 07:42:05 +0000 (09:42 +0200)]
ivy.el (ivy-use-ignore-default): New defcustom
* ivy.el (ivy-use-ignore): Is now set to `ivy-use-ignore-default'.
(ivy-toggle-ignore): Update.
(ivy--reset-state): Update.
(ivy--switch-buffer-matcher): When `ivy-use-ignore' is t, and they
only cands that match the input also match `ivy-ignore-buffers' show
them anyway. But when `ivy-use-ignore' is 'always, show nothing in that
case.
of protection overlay. Changes that keep the same length of text are
probably harmless (e.g. just change of text properties). It's possible
that some harmful changes don't change text length, but the protection
overlays are already unable to catch all important changes since they
only cover 1 character each at the edges.
cc-mode modifies text properties in the buffer to cache parsing results,
therefore it's important that yasnippet not kill yasnippets when parsing
is triggered by a function that only wants to parse the
buffer (e.g. which-function-mode).
* yasnippet.el (yas--on-protection-overlay-modification): Check length
of text change to decide if change is harmful. Fix docstring.