Variable: cycle-spacing-actions

cycle-spacing-actions is a customizable variable defined in simple.el.gz.

Value

(just-one-space delete-all-space restore)

Documentation

List of actions cycled through by cycle-spacing.

Supported values are:
- just-one-space Delete all but N (prefix arg) spaces.
                        See that command's docstring for details.
- delete-space-after Delete spaces after point keeping only N.
- delete-space-before Delete spaces before point keeping only N.
- delete-all-space Delete all spaces around point.
- restore Restore the original spacing.

All actions make use of the prefix arg given to cycle-spacing in the initial invocation, i.e., just-one-space keeps this amount of spaces deleting surplus ones. just-one-space and all other actions have the contract that a positive prefix arg (or zero) only deletes tabs and spaces whereas a negative prefix arg also deletes newlines.

The delete-space-before and delete-space-after actions handle the prefix arg M-- (negative-argument) without a number provided specially: all spaces before/after point are deleted (as if N was
0) including newlines (as if N was negative).

In addition to the predefined actions listed above, any function which accepts one argument is allowed. It receives the raw prefix arg of this cycle.

In addition, an action may take the form (ACTION ARG) where ACTION is one of the predefined actions (except for restore) and ARG is either
- an integer with the meaning that ACTION should always use this
  fixed integer instead of the actual prefix arg or
- the symbol inverted-arg with the meaning that ACTION should
  be performed with the inverted actual prefix arg.
- the symbol - with the meaning that ACTION should include
  newlines but it's up to the ACTION to decide how to interpret
  it as a number, e.g., delete-space-before and
  delete-space-after treat it like 0 whereas just-one-space
  treats it like -1 as is usual.

This variable was added, or its default value changed, in Emacs 29.1.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defcustom cycle-spacing-actions
  '( just-one-space
     delete-all-space
     restore)
  "List of actions cycled through by `cycle-spacing'.
Supported values are:
- `just-one-space'      Delete all but N (prefix arg) spaces.
                        See that command's docstring for details.
- `delete-space-after'  Delete spaces after point keeping only N.
- `delete-space-before' Delete spaces before point keeping only N.
- `delete-all-space'    Delete all spaces around point.
- `restore'             Restore the original spacing.

All actions make use of the prefix arg given to `cycle-spacing'
in the initial invocation, i.e., `just-one-space' keeps this
amount of spaces deleting surplus ones.  `just-one-space' and all
other actions have the contract that a positive prefix arg (or
zero) only deletes tabs and spaces whereas a negative prefix arg
also deletes newlines.

The `delete-space-before' and `delete-space-after' actions handle
the prefix arg \\[negative-argument] without a number provided
specially: all spaces before/after point are deleted (as if N was
0) including newlines (as if N was negative).

In addition to the predefined actions listed above, any function
which accepts one argument is allowed.  It receives the raw
prefix arg of this cycle.

In addition, an action may take the form (ACTION ARG) where
ACTION is one of the predefined actions (except for `restore')
and ARG is either
- an integer with the meaning that ACTION should always use this
  fixed integer instead of the actual prefix arg or
- the symbol `inverted-arg' with the meaning that ACTION should
  be performed with the inverted actual prefix arg.
- the symbol `-' with the meaning that ACTION should include
  newlines but it's up to the ACTION to decide how to interpret
  it as a number, e.g., `delete-space-before' and
  `delete-space-after' treat it like 0 whereas `just-one-space'
  treats it like -1 as is usual."
  :group 'editing-basics
  :type (let ((actions
               '((const :tag "Just N (prefix arg) spaces" just-one-space)
                 (const :tag "Delete spaces after point" delete-space-after)
                 (const :tag "Delete spaces before point" delete-space-before)
                 (const :tag "Delete all spaces around point" delete-all-space)
                 (function :tag "Function receiving a numeric arg"))))
          `(repeat
            (choice
             ,@actions
             (list :tag "Action with modified arg"
                   (choice ,@actions)
                   (choice (const :tag "Inverted prefix arg" inverted-arg)
                           (integer :tag "Fixed numeric arg")
                           (const :tag "Negative arg" -)))
             (const :tag "Restore the original spacing" restore))))
  :version "29.1")