Fixup the last commit and add contribution guidelines

* avy.el (avy-goto-char):
(avy-goto-char-2):
(avy-goto-word-1):
(avy-goto-subword-1):
(avy-goto-word-or-subword-1): Update argument list and docstring.

* README.md: Add a "Contributing" section.

Re #44
This commit is contained in:
Oleh Krehel 2015-05-17 12:36:37 +02:00
parent 59c6b9d15e
commit 50cfc74ed0
2 changed files with 45 additions and 32 deletions

View File

@ -100,3 +100,19 @@ The styles to choose from:
- post: the full path will be displayed after target, leaving all original text
At first it seems that `pre` and `post` are advantageous over `at` and `at-full`, since you can still see the original text with them. However, they make the text shift a bit. If you don't like that, use either `at` or `at-full`.
## Contributing
### Copyright Assignment
Avy is subject to the same [copyright assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html) policy as Emacs itself, org-mode, CEDET and other packages in [GNU ELPA](http://elpa.gnu.org/packages/). Any [legally significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant) contributions can only be accepted after the author has completed their paperwork. Please see [the request form](http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future) if you want to proceed.
The copyright assignment isn't a big deal, it just says that the copyright for your submitted changes to Emacs belongs to the FSF. This assignment works for all projects related to Emacs. To obtain it, you need to send one email, then send one letter (if you live in the US, it's digital), and wait for some time (in my case, I had to wait for one month).
### Style
The basic code style guide is to use `(setq indent-tabs-mode nil)`. It is provided for you in [.dir-locals.el](https://github.com/abo-abo/avy/blob/master/.dir-locals.el), please obey it.
Before submitting the change, run `make compile` and `make test` to make sure that it doesn't introduce new compile warnings or test failures. Also run <kbd>M-x</kbd> `checkdoc` to see that your changes obey the documentation guidelines.
Use your own judgment for the commit messages, I recommend a verbose style using `magit-commit-add-log`.

53
avy.el
View File

@ -516,11 +516,11 @@ STYLE determines the leading char overlay style."
;;* Commands
;;;###autoload
(defun avy-goto-char (arg char)
"Read one char and jump to it.
(defun avy-goto-char (char &optional arg)
"Jump to the currently visible CHAR.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive (list current-prefix-arg
(read-char "char: ")))
(interactive (list (read-char "char: ")
current-prefix-arg))
(avy--with-avy-keys avy-goto-char
(avy--generic-jump
(if (= 13 char)
@ -530,17 +530,15 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
avy-style)))
;;;###autoload
(defun avy-goto-char-2 (arg char1 char2)
"Read two consecutive chars and jump to the first one.
(defun avy-goto-char-2 (char1 char2 &optional arg)
"Jump to the currently visible CHAR1 followed by CHAR2.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive (list current-prefix-arg
(read-char "char 1: ")
(read-char "char 2: ")))
(interactive (list (read-char "char 1: ")
(read-char "char 2: ")
current-prefix-arg))
(avy--with-avy-keys avy-goto-char-2
(avy--generic-jump
(regexp-quote (string
char1
char2))
(regexp-quote (string char1 char2))
arg
avy-style)))
@ -566,11 +564,11 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
(avy--generic-jump "\\b\\sw" arg avy-style)))
;;;###autoload
(defun avy-goto-word-1 (arg char)
"Read one char at word start and jump there.
(defun avy-goto-word-1 (char &optional arg)
"Jump to the currently visible CHAR at a word start.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive (list current-prefix-arg
(read-char "char: ")))
(interactive (list (read-char "char: ")
current-prefix-arg))
(avy--with-avy-keys avy-goto-word-1
(let* ((str (string char))
(regex (cond ((string= str ".")
@ -615,25 +613,24 @@ should return true."
(avy--process candidates (avy--style-fn avy-style))))))
;;;###autoload
(defun avy-goto-subword-1 (arg char)
"Prompt for a subword start char and jump there.
(defun avy-goto-subword-1 (char arg)
"Jump to the currently visible CHAR at a subword start.
The window scope is determined by `avy-all-windows' (ARG negates it).
The case is ignored."
(interactive (list current-prefix-arg
(read-char "char: ")))
The case of CHAR is ignored."
(interactive (list (read-char "char: ")
current-prefix-arg))
(avy--with-avy-keys avy-goto-subword-1
(let ((char (downcase char)))
(avy-goto-subword-0
arg (lambda () (eq (downcase (char-after)) char))))))
(defun avy-goto-word-or-subword-1 (&optional arg)
"Jump to a word or subword start, depending on `subword-mode'.
The window scope is determined by `avy-all-windows' (ARG negates it).
The case is ignored."
(interactive "P")
(defun avy-goto-word-or-subword-1 ()
"Forward to `avy-goto-subword-1' or `avy-goto-word-1'.
Which one depends on variable `subword-mode'."
(interactive)
(if (bound-and-true-p subword-mode)
(avy-goto-subword-1 arg)
(avy-goto-word-1 arg)))
(call-interactively #'avy-goto-subword-1)
(call-interactively #'avy-goto-word-1)))
(defun avy--line (&optional arg)
"Select a line.