paredit operations (exported)
paredit operations (exported)
(append ch s tok)
returns the result of appending the applicable part of 'tok' to 's'. this is for collecting all the text on a line after 'ch'
returns the result of appending the applicable part of 'tok' to 's'. this is for collecting all the text on a line after 'ch'
(at-a-word? cm cur)
returns true if at a word of code
returns true if at a word of code
(backspace cm)
(backspace cm n)
delete 1 or n char to left
delete 1 or n char to left
(backward cm)
paredit backward exposed for keymap.
paredit backward exposed for keymap.
(backward-barf-sexp cm)
(backward-barf-sexp cm cur)
paredit backward-barf-sexp exposed for keymap.
paredit backward-barf-sexp exposed for keymap.
(backward-delete cm)
paredit backward delete exposed for keymap
paredit backward delete exposed for keymap
(backward-kill-word cm)
paredit backward-kill-word exposed for keymap.
paredit backward-kill-word exposed for keymap.
(backward-sexp cm)
(backward-sexp cm cur)
backward-sexp exposed for keymap. seems part of emacs and not part of paredit itself. but including it here since this will be used in things other than emacs itself.
backward-sexp exposed for keymap. seems part of emacs and not part of paredit itself. but including it here since this will be used in things other than emacs itself.
(backward-slurp-sexp cm)
(backward-slurp-sexp cm cur)
paredit backward-slurp-sexp exposed for keymap.
paredit backward-slurp-sexp exposed for keymap.
(backward-up cm)
(backward-up cm cur)
paredit backward-up exposed for keymap.
paredit backward-up exposed for keymap.
(backward-up-cur cm)
(backward-up-cur cm cur)
get cursor corresponding to paredit backward up
get cursor corresponding to paredit backward up
(betw-code-and-comment? cm cur)
true if code is to the left and whitespace* comment* is to the right.
true if code is to the left and whitespace* comment* is to the right.
(betw-code-and-line-end? cm)
true if code is to the left and whitespace* is to the right. assumes you already know line does not end with a comment.
true if code is to the left and whitespace* is to the right. assumes you already know line does not end with a comment.
(bkwd cm i n)
trampoline helper for backward. 'i' is the index we're inspecting. 'n' is number of remaining calls before we suspect an infinite loop
trampoline helper for backward. 'i' is the index we're inspecting. 'n' is number of remaining calls before we suspect an infinite loop
(bkwd-barf cm cur n)
trampoline-able that looks for an ancestor opening bracket (parent, grandparent, etc) that has a sibling to barf. returns... . nil if there is no such anscestor that can barf
trampoline-able that looks for an ancestor opening bracket (parent, grandparent, etc) that has a sibling to barf. returns... . nil if there is no such anscestor that can barf
(bkwd-down cm cur n)
trampoline-able that looks for the cursor where we'd be if we went backward and then down into the prev sibling that is available. nil if there is no sibling to enter.
trampoline-able that looks for the cursor where we'd be if we went backward and then down into the prev sibling that is available. nil if there is no sibling to enter.
(bkwd-kill-word cm mark i n)
trampoline helper for backward-kill-word. 'mark' is the index to start killing from. 'i' is the index we're inspecting. 'n' is how many more calls we'll entertain before stopping because we suspect an infinite loop. first call can use char count for 'n'.
trampoline helper for backward-kill-word. 'mark' is the index to start killing from. 'i' is the index we're inspecting. 'n' is how many more calls we'll entertain before stopping because we suspect an infinite loop. first call can use char count for 'n'.
(bkwd-slurp cm cur n)
trampolin-able that looks for an ancestor opening bracket (parent, grandparent, etc) that has a sibling to slurp. returns a vector of the cur to the left of such a bracket, the cur to the left of the sibling that will be slurped, the string of the bracket to move. nil if there is no such anscestor that can slurp.
trampolin-able that looks for an ancestor opening bracket (parent, grandparent, etc) that has a sibling to slurp. returns a vector of the cur to the left of such a bracket, the cur to the left of the sibling that will be slurped, the string of the bracket to move. nil if there is no such anscestor that can slurp.
(bracket? cm cur)
true if cursor info indicates opening/closing bracket or quote
true if cursor info indicates opening/closing bracket or quote
(char-count cm)
returns the number of characters in the code mirror instance
returns the number of characters in the code mirror instance
(close-brace cm)
close curly brace like close-rond
close curly brace like close-rond
(close-round cm)
(close-round cm s)
paredit-close-round exposed for keymap. skips to end of current list even if it ends with ] or }. but if you're in a string or comment then this just inserts the bracket. requires CodeMirror mode's parser uses state with indentStack because that's how we can tell we've reached the end of a top level form and avoid entering the next top level form. 's' is the character as a string.
paredit-close-round exposed for keymap. skips to end of current list even if it ends with ] or }. but if you're in a string or comment then this just inserts the bracket. requires CodeMirror mode's parser uses state with indentStack because that's how we can tell we've reached the end of a top level form and avoid entering the next top level form. 's' is the character as a string.
(closing-delim? cm cur)
returns true for closing brackets and for closing double-quotes
returns true for closing brackets and for closing double-quotes
(closing-doublequote? cm cur)
returns true if cur is just to the right of a closing doublequote
returns true if cur is just to the right of a closing doublequote
(code-to-left? cm)
returns true if there's any code to the left of cursor. assumes you've already ruled out comments so only looks for non nil tokens
returns true if there's any code to the left of cursor. assumes you've already ruled out comments so only looks for non nil tokens
(comment-or-string? type)
true if the type is comment or string. a lot of editing behavior (like movement and deletion) is similar when you are in a string or in a comment, so often this is the predicate for that behavior.
true if the type is comment or string. a lot of editing behavior (like movement and deletion) is similar when you are in a string or in a comment, so often this is the predicate for that behavior.
(create-comment-at-end cm)
starts a ; comment at column 40 or greater and moves to it.
starts a ; comment at column 40 or greater and moves to it.
(create-line-comment cm)
creates and indents a ;; comment
creates and indents a ;; comment
(cursor cm)
(cursor cm i)
get cur, the position of the cursor
get cur, the position of the cursor
(delete cm)
(delete cm n)
delete 1 or n char to right
delete 1 or n char to right
(delete-pair cm)
assumes a pair of brackets surround the cursor. deletes the pair.
assumes a pair of brackets surround the cursor. deletes the pair.
(delete-to-end-of-line cm)
deletes from current position to the end of the line
deletes from current position to the end of the line
(delete-whitespace cm)
(delete-whitespace cm cur)
(delete-whitespace cm cur indent-after)
if cur is in whitespace, deletes it optionally without ruining indentation.
if cur is in whitespace, deletes it optionally without ruining indentation.
(end-of-a-string? cm cur)
returns true if just to the right of a closing doublequote of a string.
returns true if just to the right of a closing doublequote of a string.
(end-of-next-sibling cm)
(end-of-next-sibling cm cur)
get the cursor for the end of the sibling to the right.
get the cursor for the end of the sibling to the right.
(end-of-next-sibling-sp cm cur stack)
returns the cursor at the end of the sibling to the right or nil if no sibling or eof. does not exit the containing form. does this by skipping past any comments or whitespace, and branches depending on whether an opening bracket or doublequote is encountered (sp satisfied when encountering a closing bracket that empties the stack) vs the beginning of a word (return token at the end of the word). assuming the cm has matched brackets for now.
returns the cursor at the end of the sibling to the right or nil if no sibling or eof. does not exit the containing form. does this by skipping past any comments or whitespace, and branches depending on whether an opening bracket or doublequote is encountered (sp satisfied when encountering a closing bracket that empties the stack) vs the beginning of a word (return token at the end of the word). assuming the cm has matched brackets for now.
(end-of-next-word cm i)
assumes i is in a comment or a string. returns the i at the end of the next word (going to the right) in this comment/string
assumes i is in a comment or a string. returns the i at the end of the next word (going to the right) in this comment/string
(end-of-this cm cur)
go to the end of the current thing, whether it be a string or a word of code
go to the end of the current thing, whether it be a string or a word of code
(escape-string s)
escapes a string, replacing backslashes and doublequotes. wraps result in a new pair of doublequotes.
escapes a string, replacing backslashes and doublequotes. wraps result in a new pair of doublequotes.
(escaped-char-to-left? cm cur)
returns true if an escaped char and its backslash are to the left
returns true if an escaped char and its backslash are to the left
(escaped-char-to-right? cm cur)
returns true if an escaped char and its backslash is to the right
returns true if an escaped char and its backslash is to the right
(exit-string cm)
moves cursor right, out of the current string
moves cursor right, out of the current string
(forward cm)
paredit forward exposed for keymap. find the first thing that isn't whitespace or comment. if it is a closing bracket, step past it. otherwise skip over the thing.
paredit forward exposed for keymap. find the first thing that isn't whitespace or comment. if it is a closing bracket, step past it. otherwise skip over the thing.
(forward-barf-sexp cm)
(forward-barf-sexp cm cur)
paredit forward-barf-sexp exposed for keymap.
paredit forward-barf-sexp exposed for keymap.
(forward-delete cm)
paredit-forward-delete exposed for keymap
paredit-forward-delete exposed for keymap
(forward-kill-word cm)
paredit forward-kill-word exposed for keymap.
paredit forward-kill-word exposed for keymap.
(forward-sexp cm)
(forward-sexp cm cur)
forward-sexp exposed for keymap. seems part of emacs and not part of paredit itself. but including it here since this will be used in things other than emacs itself.
forward-sexp exposed for keymap. seems part of emacs and not part of paredit itself. but including it here since this will be used in things other than emacs itself.
(forward-slurp-sexp cm)
(forward-slurp-sexp cm cur)
paredit forward-slurp-sexp exposed for keymap.
paredit forward-slurp-sexp exposed for keymap.
(forward-up cm)
(forward-up cm cur)
paredit forward-up exposed for keymap.
paredit forward-up exposed for keymap.
(forward-up-cur cm)
(forward-up-cur cm cur)
get cursor corresponding to paredit forward up
get cursor corresponding to paredit forward up
(fwd cm i n)
trampoline helper for forward. 'i' is the index we're inspecting. 'n' is how many more calls we'll entertain before suspecting an infinite loop. first call can pass in char count.
trampoline helper for forward. 'i' is the index we're inspecting. 'n' is how many more calls we'll entertain before suspecting an infinite loop. first call can pass in char count.
(fwd-barf cm cur n)
trampoline-able that looks for an ancestor closing bracket (parent, grandparent, etc) that has a sibling to barf. returns a vector of the cur to the right of such a bracket, the cur at the bracket, the cur where the bracket should go, the text of the bracket, and whether the operation causes the cursor to be moved. nil if there is no such anscestor that can barf
trampoline-able that looks for an ancestor closing bracket (parent, grandparent, etc) that has a sibling to barf. returns a vector of the cur to the right of such a bracket, the cur at the bracket, the cur where the bracket should go, the text of the bracket, and whether the operation causes the cursor to be moved. nil if there is no such anscestor that can barf
(fwd-down cm cur n)
trampoline-able that looks for the cursor where we'd be if we went forward and then down into the next sibling that is available. nil if there is no sibling to enter.
trampoline-able that looks for the cursor where we'd be if we went forward and then down into the next sibling that is available. nil if there is no sibling to enter.
(fwd-kill-word cm mark i n)
trampoline helper for forward-kill-word. 'mark' is the index to start killing from. 'i' is the index we're inspecting. 'n' is how many calls remaining that we'll support before stopping because of a suspected infinite loop. first call can put the count of characters in this cm instance.
trampoline helper for forward-kill-word. 'mark' is the index to start killing from. 'i' is the index we're inspecting. 'n' is how many calls remaining that we'll support before stopping because of a suspected infinite loop. first call can put the count of characters in this cm instance.
(fwd-slurp cm cur n)
trampoline-able that looks for an ancestor closing bracket (parent, grandparent, etc) that has a sibling to slurp. returns a vector of the cur to the right of such a bracket, the cur to the right of the sibling that will be slurped, the string of the bracket to move. nil if there is no such anscestor that can slurp.
trampoline-able that looks for an ancestor closing bracket (parent, grandparent, etc) that has a sibling to slurp. returns a vector of the cur to the right of such a bracket, the cur to the right of the sibling that will be slurped, the string of the bracket to move. nil if there is no such anscestor that can slurp.
(fwd-string-barf cm cur)
String barffing consists of simply 'go to end of string, mark as parent, reverse look for non whitespace, reverse look for whitespace, mark as sibling'
String barffing consists of simply 'go to end of string, mark as parent, reverse look for non whitespace, reverse look for whitespace, mark as sibling'
(fwd-string-slurp cm cur)
String slurping consists of simply 'go to end of string, mark as parent, go to next sibling end, mark as sibling'
String slurping consists of simply 'go to end of string, mark as parent, go to next sibling end, mark as sibling'
(get-info cm)
(get-info cm cur)
make info from CodeMirror more conveniently accessed by our code. we'll use destructuring and just name what we rant. hypothesizing that performance hit won't be that bad.
make info from CodeMirror more conveniently accessed by our code. we'll use destructuring and just name what we rant. hypothesizing that performance hit won't be that bad.
(get-string cm)
(get-string cm cur)
gets the string of the current token
gets the string of the current token
(get-type cm)
(get-type cm cur)
get the type at the current cursor.
get the type at the current cursor.
(get-types cm c1 c2)
get the types from cursors c1 to c2. assumes 1 is to the left of 2 and not vice versa.
get the types from cursors c1 to c2. assumes 1 is to the left of 2 and not vice versa.
(go-to-comment-and-indent cm)
moves cursor to the comment on the line and makes sure the comment starts on column 40 or greater. assumes last token is a comment
moves cursor to the comment on the line and makes sure the comment starts on column 40 or greater. assumes last token is a comment
(go-to-end-of-string cm)
(go-to-end-of-string cm cur)
moves cursor to end of the string you're in (but still inside the closing doublequote). assumes you're in a string. the end could be on a different line from where you start
moves cursor to end of the string you're in (but still inside the closing doublequote). assumes you're in a string. the end could be on a different line from where you start
(in-a-word? cm)
true if in a word AND not at the end of that word. false if in whitespace or a string or a comment or at a bracket.
true if in a word AND not at the end of that word. false if in whitespace or a string or a comment or at a bracket.
(in-code? cm)
returns true if token is in the middle of code. assumes you've already ruled out comments.
returns true if token is in the middle of code. assumes you've already ruled out comments.
(in-escaped-char? cm cur)
(in-escaped-char? cm cur offset)
returns true if backslash is to the left and cursor is on an escaped char
returns true if backslash is to the left and cursor is on an escaped char
(in-regular-string? cm cur)
returns true if token is in the middle of a string.
returns true if token is in the middle of a string.
(in-string? cm)
(in-string? cm cur)
returns true if token is in the middle of a string.
returns true if token is in the middle of a string.
(in-whitespace? cm)
returns true if token is to the right of whitespace
returns true if token is to the right of whitespace
(indent-lines cm a z)
indents lines from a to z (line numbers). assumes a is before z.
indents lines from a to z (line numbers). assumes a is before z.
(index cm)
(index cm cur)
get the index i for the cursor's position
get the index i for the cursor's position
(insert cm text)
(insert cm text offset)
(insert cm text offset cur)
insert text at current cursor. move cursor to the end of inserted text minus optional offset. the offset is for moving the cursor immediately after the insert and before returning. example: inserting a pair of brackets and placing the cursor inside the pair. this returns the new cursor.
insert text at current cursor. move cursor to the end of inserted text minus optional offset. the offset is for moving the cursor immediately after the insert and before returning. example: inserting a pair of brackets and placing the cursor inside the pair. this returns the new cursor.
(insert-line-comment-here cm)
creates and indents a ;; comment on this line
creates and indents a ;; comment on this line
(insert-spaces-to-col-40 cm)
presses spacebar until we are at col 40
presses spacebar until we are at col 40
(join-sexps cm)
(join-sexps cm cur)
paredit join-sexps exposed for keymap.
paredit join-sexps exposed for keymap.
(just-one-space cm)
(just-one-space cm cur)
(just-one-space cm cur indent-after)
(kill cm)
paredit kill exposed for keymap.
paredit kill exposed for keymap.
(kill-next-sibling cm)
kills the next sibling to the right of the cursor
kills the next sibling to the right of the cursor
(kill-next-word cm i)
assumes i is in a comment or a string. kills text from i to the end of the next word in this comment/string
assumes i is in a comment or a string. kills text from i to the end of the next word in this comment/string
(kill-pair cm)
assumes a pair of brackets surround the cursor. deletes the pair.
assumes a pair of brackets surround the cursor. deletes the pair.
(kill-prev-word-in-comment cm i)
assumes i is in a comment. kills text from i to the beginning of the previous word in this comment
assumes i is in a comment. kills text from i to the beginning of the previous word in this comment
(last-cur cm)
(last-cur cm cur)
returns the last cursor of a line
returns the last cursor of a line
(last-token cm cur)
returns the last token of a line
returns the last token of a line
(left cm c1 c2)
given a pair of cursors c1 and c2, returns the left-most one
given a pair of cursors c1 and c2, returns the left-most one
(line-ends-with-comment? cm)
true if the line ends with a comment
true if the line ends with a comment
(line-is-whitespace? cm)
returns true if line is all whitespace
returns true if line is all whitespace
(line-length cm)
(line-length cm cur)
gets the length of the current line
gets the length of the current line
(meta-doublequote cm)
paredit meta-doublequote exposed for keymap. if in a string, moves cursor out of the string to the right. if in a comment, insert a doublequote. if in an escaped char, do nothing. otherwise starts a string that that continues to the end of the next form, escaping backslashes and doublequotes.
paredit meta-doublequote exposed for keymap. if in a string, moves cursor out of the string to the right. if in a comment, insert a doublequote. if in an escaped char, do nothing. otherwise starts a string that that continues to the end of the next form, escaping backslashes and doublequotes.
(move cm offset)
moves the cursor by 'offset' places, negative for left. returns the cursor.
moves the cursor by 'offset' places, negative for left. returns the cursor.
(move-past-parent-closer cm)
moves cursor to just outside the closing bracket, or if there is none then doesn't move at all.
moves cursor to just outside the closing bracket, or if there is none then doesn't move at all.
(move-to-end-of-line cm)
(move-to-end-of-line cm cur)
moves cursor to end of last non-whitespace token on a line. returns a vector of new index, new ch, and new cursor.
moves cursor to end of last non-whitespace token on a line. returns a vector of new index, new ch, and new cursor.
(new-line-and-comment cm)
creates and indents a ;; comment on a new line
creates and indents a ;; comment on a new line
(open-brace cm)
open curly brace with matching close brace
open curly brace with matching close brace
(open-round cm)
(open-round cm c)
paredit-open-round exposed for keymap. unlike traditional emacs paredit, this supports brackets [] {} () but not double-quote
paredit-open-round exposed for keymap. unlike traditional emacs paredit, this supports brackets [] {} () but not double-quote
(opening-delim-for-empty-pair? cm cur)
returns true for an opening bracket of an empty pair ()
returns true for an opening bracket of an empty pair ()
(opening-delim-for-non-empty-pair? cm)
returns true for an opening bracket of a pair that contains one or more chars.
returns true for an opening bracket of a pair that contains one or more chars.
(opening-delim? cm cur)
returns true for opening brackets and for opening double-quotes
returns true for opening brackets and for opening double-quotes
(opening-doublequote? cm cur)
(opening-doublequote? cm type left-char right-cur)
returns true if cur is just to the right of an opening doublequote
returns true if cur is just to the right of an opening doublequote
(pair? s1 s2)
true if the two strings are a matching open/close pair
true if the two strings are a matching open/close pair
(parent-closer-sp cm cur state)
finds the parent closing bracket. behavior when used with skip: pushes opening brackets that appear along the way on a stack. closing brackets pop them off. stops when encountering a closing bracket while the stack is empty. assuming the cm has matched brackets for now. moves to the right.
finds the *parent* closing bracket. behavior when used with skip: pushes opening brackets that appear along the way on a stack. closing brackets pop them off. stops when encountering a closing bracket while the stack is empty. assuming the cm has matched brackets for now. moves to the right.
(raise-sexp cm)
(raise-sexp cm cur)
paredit raise-sexp exposed for keymap.
paredit raise-sexp exposed for keymap.
(reindent-defun cm)
(reindent-defun cm cur)
paredit reindent-defun exposed for keymap.
paredit reindent-defun exposed for keymap.
(right cm c1 c2)
given a pair of cursors c1 and c2, returns the right-most one
given a pair of cursors c1 and c2, returns the right-most one
(right-cur-would-be-whitespace? cm cur right-cur)
true if this position would be whitespace if we pressed the spacebar.
true if this position would be whitespace if we pressed the spacebar.
(select-pair cm)
assumes a pair of brackets surround the cursor. selects the pair.
assumes a pair of brackets surround the cursor. selects the pair.
(select-rest-of-line cm)
selects from current position to the end of the line
selects from current position to the end of the line
(select-rest-of-string cm)
assumes you are in a string.
assumes you are in a string.
(selection-completely-satisfies-pred? cm pred)
true if every position's type satisfies pred, for the entire (first) selection
true if every position's type satisfies pred, for the entire (first) selection
(selection-info cm)
like get-info but for the first selection. gets the cursor to the left of the selection, the start, the end, the text selected, the starting and ending line numbers. nil if nothing selected.
like get-info but for the first selection. gets the cursor to the left of the selection, the start, the end, the text selected, the starting and ending line numbers. nil if nothing selected.
(skip cm sp)
(skip cm sp cur)
returns the cursor that satisfies sp or nil if either eof reached or we found out sp could not be satisfied. see skip-to for more info.
returns the cursor that satisfies sp or nil if either eof reached or we found out sp could not be satisfied. see skip-to for more info.
(skip-left cm sp)
returns the cursor that satisfies sp or nil if either bof reached or we found out sp could not be satisfied. see skip-to for more info.
returns the cursor that satisfies sp or nil if either bof reached or we found out sp could not be satisfied. see skip-to for more info.
(skip-to cm sp)
moves to the cursor that satisfies sp or doesn't move if eof reached. starts at current cursor for cm. sp stands for 'skipping predicate' which returns:
moves to the cursor that satisfies sp or doesn't move if eof reached. starts at current cursor for cm. sp stands for 'skipping predicate' which returns: - :yes if sp is satisfied. - :stop if we know we will not be satisfied with any future result. - :left if the cursor to the left is what we want. - new non-nil state if not satisfied. this state is used with the next iteration after we skip to the end of the current token. an sp takes cm, cursor, state.
(skip-trampoline-helper cm cur sp state n)
returns the cursor that satsifies skipping predicate 'sp' or nil if eof reached. does this by making sp something we can trampoline. sp takes these args: cm, cursor, state. counts down 'n' to 0 in order to guard against infinite loops.
returns the cursor that satsifies skipping predicate 'sp' or nil if eof reached. does this by making sp something we can trampoline. sp takes these args: cm, cursor, state. counts down 'n' to 0 in order to guard against infinite loops.
(skip-trampoline-helper-left cm cur sp state n)
like skip-trampoline-helper but in the opposite direction.
like skip-trampoline-helper but in the opposite direction.
(splice-sexp cm)
(splice-sexp cm cur)
paredit splice-sexp exposed for keymap. unlike emacs' version, this does not splice a string by dropping its double-quotes.
paredit splice-sexp exposed for keymap. unlike emacs' version, this does not splice a string by dropping its double-quotes.
(splice-sexp-killing-backward cm)
(splice-sexp-killing-backward cm cur)
paredit splice-sexp-killing-backward exposed for keymap. like emacs' version, this doesn't actually kill to the clipboard. it just deletes. but unlink emacs, this does not splice a string by dropping its double-quotes.
paredit splice-sexp-killing-backward exposed for keymap. like emacs' version, this doesn't actually kill to the clipboard. it just deletes. but unlink emacs, this does not splice a string by dropping its double-quotes.
(splice-sexp-killing-forward cm)
(splice-sexp-killing-forward cm cur)
paredit splice-sexp-killing-forward exposed for keymap. like emacs' version, this doesn't actually kill to the clipboard. it just deletes. but unlink emacs, this does not splice a string by dropping its double-quotes.
paredit splice-sexp-killing-forward exposed for keymap. like emacs' version, this doesn't actually kill to the clipboard. it just deletes. but unlink emacs, this does not splice a string by dropping its double-quotes.
(split-form cm cur)
split sexp for (forms like this)
split sexp for (forms like this)
(split-sexp cm)
(split-sexp cm cur)
paredit split-sexp exposed for keymap.
paredit split-sexp exposed for keymap.
(split-string cm cur)
split sexp for "strings like this"
split sexp for "strings like this"
(start-of-a-string? cm cur)
returns true if at the start of a string.
returns true if at the start of a string.
(start-of-comment? cm cur)
true if block cursor is on the first ; of a line comment
true if block cursor is on the first ; of a line comment
(start-of-prev-sibling cm)
(start-of-prev-sibling cm cur)
return the cursor at the start of the sibling to the left.
return the cursor at the start of the sibling to the left.
(start-of-prev-sibling-sp cm cur stack)
returns the cursor at the start of the sibling to the left or nil if no sibling or eof. does not exit the containing form. does this by skipping past any comments or whitespace, and branches depending on whether a bracket or doublequote is encountered (sp satisfied when encountering an opening bracket that empties the stack) vs the beginning of a word (return token at the start of the word). assuming the cm has matched brackets for now.
returns the cursor at the start of the sibling to the left or nil if no sibling or eof. does not exit the containing form. does this by skipping past any comments or whitespace, and branches depending on whether a bracket or doublequote is encountered (sp satisfied when encountering an opening bracket that empties the stack) vs the beginning of a word (return token at the start of the word). assuming the cm has matched brackets for now.
(start-of-prev-word cm i)
assumes i is in a comment or a string. returns the i at the start of the prev word (going to the left) in this comment/string
assumes i is in a comment or a string. returns the i at the start of the prev word (going to the left) in this comment/string
(str-ends-on-another-line? type string)
true if these values are from a string token that ends on another line
true if these values are from a string token that ends on another line
(stringify cm cur-1 cur-2)
turns the region from cur-1 to cur-2 into a string, escaping backslashes and doublequotes
turns the region from cur-1 to cur-2 into a string, escaping backslashes and doublequotes
(stringify-selection cm)
turns selection into a string, escaping backslashes and doublequotes
turns selection into a string, escaping backslashes and doublequotes
(to-comment s postscript)
starts each line in 's' with ;; and appends 'post-script'
starts each line in 's' with ;; and appends 'post-script'
(token-end cm cur)
(token-end cm cur offset)
returns the cursor for the end of the current token
returns the cursor for the end of the current token
(token-end-index cm i)
take an index. get its token. return index of that token's end.
take an index. get its token. return index of that token's end.
(token-start cm cur)
returns the cursor for the start of the current token
returns the cursor for the start of the current token
(top-most-opener cm)
(top-most-opener cm cur)
get the top most opening bracket for the specified location. nil if there is no such bracket.
get the top most opening bracket for the specified location. nil if there is no such bracket.
(top-most-opener-candidate cm cur n)
trampoline-able that looks for the top-most opening bracket for the specified location. returns the current cursor if there is no such anscestor
trampoline-able that looks for the top-most opening bracket for the specified location. returns the current cursor if there is no such anscestor
(uncomment s)
removes leading whitespace and semicolons from lines in 's'
removes leading whitespace and semicolons from lines in 's'
(uncomment-selection cm)
removes whitespace and leading semicolons from selection, replaces selection with the result, indents lines affected.
removes whitespace and leading semicolons from selection, replaces selection with the result, indents lines affected.
(whitespace? cm cur)
returns true if cursor indicates whitespace
returns true if cursor indicates whitespace
(wrap-round cm)
(wrap-round cm cur)
paredit wrap-round exposed for keymap.
paredit wrap-round exposed for keymap.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close