Skip to content

Commit

Permalink
Merge e50a6ec into 6f2efaa
Browse files Browse the repository at this point in the history
  • Loading branch information
Ergus committed May 3, 2021
2 parents 6f2efaa + e50a6ec commit acb5219
Show file tree
Hide file tree
Showing 7 changed files with 385 additions and 228 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,38 @@
name: Test composable in emacs

on: [push]

jobs:
test:
name: Test ${{ matrix.emacs_version }}
runs-on: ubuntu-latest
strategy:
matrix:
emacs_version:
- '25.1'
- '26.3'
- '27.1'
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
python-version: '3.6'
architecture: 'x64'

- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}

- uses: conao3/setup-cask@master
with:
version: 'snapshot'

- name: Build
run: cask

- name: Test
run: make test

# A pretty complete example
# https://github.com/szermatt/emacs-bash-completion/blob/fa5557709ee11b41a2b5393efe60cd464c56f76e/.github/workflows/test.yml

11 changes: 6 additions & 5 deletions .travis.yml
@@ -1,4 +1,5 @@
dist: trusty
os: linux
dist: xenial

language: generic

Expand All @@ -8,10 +9,10 @@ before_install:
- cask

env:
matrix:
- EVM_EMACS=emacs-24.5-travis
- EVM_EMACS=emacs-26.3-travis
- EVM_EMACS=emacs-git-snapshot-travis
jobs:
- EVM_EMACS=emacs-25.1-travis
- EVM_EMACS=emacs-26.3-travis-linux-xenial
- EVM_EMACS=emacs-git-snapshot-travis-linux-xenial

script:
- emacs --version
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -13,3 +13,6 @@ test:
plain:
$(EMACS) --version
$(EMACS) $(LOAD) -f composable-mode -f composable-mark-mode

compile:
${EMACS} -Q --batch -L . -f batch-byte-compile composable.el composable-*.el
22 changes: 15 additions & 7 deletions README.md
Expand Up @@ -273,17 +273,14 @@ end. But <kbd>C-w , h</kbd> will kill one paragraph backwards and

### With pair movements

With the function `composable-add-pair` you can define movement
commands to be each others pair. For instance the following pair is
defined by default.
The variable `composable-fn-pair-alist` define movement commands
to be each others pair. For instance the following pair is defined by
default.

```lisp
(composable-add-pair 'forward-word 'backward-word)
(add-to-list 'composable-fn-pair-alist '(forward-word . backward-word))
```

Alternatively multiple several pairs can be defined with
`composable-add-pairs`.

When a prefix argument is specified before a paired movement command
(begin and end are treated the same) the two commands are used to
establish a region. For instance both <kbd>M-w , f</kbd> and <kbd>M-w . f</kbd> will save the
Expand Down Expand Up @@ -319,6 +316,17 @@ To disable this feature just add:

to your config.

## Debug messages

Composable has a way to control the messages printed in the minibuffer
and/or the \*Messages\* using the variable
`composable-mode-debug-level' which has the following valid values:

* **0**: No debug info is printed at all.
* **1**: The debug info is printed only in the \*Messages\* buffer but not in the minibuffer.
* **2**: The debug info is printed in \*Messages\* and in the minibuffer.


## Kill specific options

Composable implements a special version for `copy-region-as-kill`
Expand Down
20 changes: 10 additions & 10 deletions composable-mark.el
Expand Up @@ -29,7 +29,7 @@
(defvar composable--border-point)
(defvar composable--count)

(defun composable--direction (arg)
(defsubst composable--direction (arg)
"Direction of ARG."
(let ((n (prefix-numeric-value arg))) (/ n (abs n))))

Expand All @@ -39,10 +39,9 @@ Between the line above if ARG is negative otherwise below."
(interactive "p")
(forward-line arg)
(cl-flet ((move (dir)
(funcall (if (< 0 dir)
'skip-chars-forward
'skip-chars-backward)
"[:space:]\n")))
(if (< 0 dir)
(skip-chars-forward "[:space:]\n")
(skip-chars-backward "[:space:]\n"))))
(when (< arg 0) (end-of-line))
(move arg)
(push-mark nil nil t)
Expand All @@ -59,8 +58,8 @@ The movement must mark backwards with negative arguments."
(setq composable--border-point (point-marker))
(set-mark (point))
(if (< 0 amount)
(goto-char (min (mark t) (point)))
(goto-char (max (mark t) (point)))))
(goto-char (min (mark t) (point)))
(goto-char (max (mark t) (point)))))
(funcall ,forward amount)))

(defun composable-mark-line (arg)
Expand Down Expand Up @@ -89,9 +88,10 @@ Supports negative arguments and repeating."

(defun composable--up-list (arg)
"Up-list ARG times with better quotes support."
(if (nth 3 (syntax-ppss))
(goto-char (nth 8 (syntax-ppss)))
(up-list arg)))
(let ((syntax-ppss (syntax-ppss)))
(if (nth 3 syntax-ppss)
(goto-char (nth 8 syntax-ppss))
(up-list arg))))

(defun composable-mark-up-list (arg)
"Mark ARG upper lists.
Expand Down

0 comments on commit acb5219

Please sign in to comment.