editor/format: update documentation
This commit is contained in:
parent
1ae3523f75
commit
1b4040229e
1 changed files with 16 additions and 4 deletions
|
@ -3,11 +3,12 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(autoload 'format-all-probe "format-all")
|
(autoload 'format-all-probe "format-all")
|
||||||
|
|
||||||
;; Stolen shamelessly from go-mode
|
|
||||||
(defun +format--delete-whole-line (&optional arg)
|
(defun +format--delete-whole-line (&optional arg)
|
||||||
"Delete the current line without putting it in the `kill-ring'.
|
"Delete the current line without putting it in the `kill-ring'.
|
||||||
Derived from function `kill-whole-line'. ARG is defined as for that
|
Derived from function `kill-whole-line'. ARG is defined as for that
|
||||||
function."
|
function.
|
||||||
|
|
||||||
|
Stolen shamelessly from go-mode"
|
||||||
(setq arg (or arg 1))
|
(setq arg (or arg 1))
|
||||||
(if (and (> arg 0)
|
(if (and (> arg 0)
|
||||||
(eobp)
|
(eobp)
|
||||||
|
@ -29,10 +30,11 @@ function."
|
||||||
((delete-region (progn (forward-visible-line 0) (point))
|
((delete-region (progn (forward-visible-line 0) (point))
|
||||||
(progn (forward-visible-line arg) (point))))))
|
(progn (forward-visible-line arg) (point))))))
|
||||||
|
|
||||||
;; Stolen shamelessly from go-mode
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +format--apply-rcs-patch (patch-buffer)
|
(defun +format--apply-rcs-patch (patch-buffer)
|
||||||
"Apply an RCS-formatted diff from PATCH-BUFFER to the current buffer."
|
"Apply an RCS-formatted diff from PATCH-BUFFER to the current buffer.
|
||||||
|
|
||||||
|
Stolen shamelessly from go-mode"
|
||||||
(let ((target-buffer (current-buffer))
|
(let ((target-buffer (current-buffer))
|
||||||
;; Relative offset between buffer line numbers and line numbers
|
;; Relative offset between buffer line numbers and line numbers
|
||||||
;; in patch.
|
;; in patch.
|
||||||
|
@ -97,6 +99,16 @@ of the buffer to apply formatting to."
|
||||||
(defun +format-buffer ()
|
(defun +format-buffer ()
|
||||||
"Format the source code in the current buffer.
|
"Format the source code in the current buffer.
|
||||||
|
|
||||||
|
Returns any of the following values:
|
||||||
|
|
||||||
|
'unknown No formatter is defined for this major-mode
|
||||||
|
'error Couldn't format buffer due to formatter errors
|
||||||
|
'noop Buffer is already formatted
|
||||||
|
|
||||||
|
Otherwise, returns a list: (list OUTPUT ERRORS FIRST-DIFF), where OUTPUT is the
|
||||||
|
formatted text, ERRORS are any errors in string format, and FIRST-DIFF is the
|
||||||
|
position of the first change in the buffer.
|
||||||
|
|
||||||
See `+format/buffer' for the interactive version of this function, and
|
See `+format/buffer' for the interactive version of this function, and
|
||||||
`+format|buffer' to use as a `before-save-hook' hook."
|
`+format|buffer' to use as a `before-save-hook' hook."
|
||||||
(require 'format-all)
|
(require 'format-all)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue