Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to test for a syntax condition without moving the cursor?
    primarykey
    data
    text
    <p>I have been unable to come up with a method to test for a syntax condition without moving the cursor -- e.g., <code>skip-syntax-forward</code> and <code>skip-chars-forward</code> both move the cursor in order to return <code>t</code> or <em>a positive value</em>. How can I return <code>t</code> or <code>nil</code> without moving the cursor?</p> <pre><code>(defun lawlist-kill-word () "Mark word / symbol + whitespace to the right of the cursor, and kill same." (interactive) (let* ( (symbol-regexp "\\s.\\|\\s_") (word-regexp "\\sw")) (modify-syntax-entry ?' "_") ;; apostrophe = symbol constituent (cond ((&lt; 0 (skip-syntax-forward "_.")) (let ((end (point))) (set-mark end) (while (looking-back symbol-regexp) (backward-char)) (let ((beg (point))) (delete-region beg end) (setq beg (point)) (cond ((skip-chars-forward " \t") (setq end (point)) (set-mark end) (delete-region beg end)))))) ((&lt; 0 (skip-syntax-forward "w")) (let ((end (point))) (set-mark end) (while (looking-back word-regexp) (backward-char)) (let ((beg (point))) (delete-region beg end) (setq beg (point)) (cond ((skip-chars-forward " \t") (setq end (point)) (set-mark end) (delete-region beg end)))))) (t (let ((beg (point))) (set-mark beg) (skip-chars-forward " \t") (let ((end (point))) (delete-region beg end))) (deactivate-mark))) (modify-syntax-entry ?' "w") )) ;; apostrophe = word constituent </code></pre> <hr> <p><strong>EDIT</strong>:  <code>lawlist-kill-word</code> is a work in progress -- any updates to this function will be posted to a thread related to that issue -- i.e.,: <a href="https://stackoverflow.com/questions/17958397/emacs-delete-whitespaces-or-a-word">Emacs: delete whitespaces or a word</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload