]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit '5c540d26479df04e7fc6b99792707457df174528'
authorArtur Malabarba <bruce.connor.am@gmail.com>
Fri, 25 Sep 2015 23:07:45 +0000 (00:07 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Fri, 25 Sep 2015 23:07:45 +0000 (00:07 +0100)
1  2 
packages/sotlisp/sotlisp.el

index 5e3dcb413cdde27b23c1d027fd3cbe2a2a4e5a8d,f77f0aca9f72aed46065c88ccfaaa90c4abf5304..f1536a07664deceea56e62ad4b89b2cee66d6e46
@@@ -1,12 -1,12 +1,12 @@@
  ;;; sotlisp.el --- Write lisp at the speed of thought.  -*- lexical-binding: t; -*-
  
 -;; Copyright (C) 2014 Free Software Foundation, Inc.
 +;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
  
 -;; Author: Artur Malabarba  <bruce.connor.am@gmail.com>
 +;; Author: Artur Malabarba  <bruce.connor.am@>
  ;; URL: https://github.com/Malabarba/speed-of-thought-lisp
  ;; Keywords: convenience, lisp
  ;; Package-Requires: ((emacs "24.1"))
- ;; Version: 1.3
+ ;; Version: 1.4
  
  ;; This program is free software; you can redistribute it and/or modify
  ;; it under the terms of the GNU General Public License as published by
@@@ -360,6 -360,7 +360,7 @@@ The space char is not included.  Any \"
      ("wl" . "when-let (($))")
      ("we" . "window-end")
      ("ws" . "window-start")
+     ("wsw" . "with-selected-window ")
      ("wtb" . "with-temp-buffer")
      ("wtf" . "with-temp-file ")
      )
@@@ -524,7 -525,8 +525,7 @@@ removes hooks and abbrevs.
                         (looking-at-p "#'")))
        (thing-at-point 'symbol)
      (let ((fcap (function-called-at-point)))
 -      (if fcap
 -          (symbol-name fcap)
 +      (if fcap (symbol-name fcap)
          (thing-at-point 'symbol)))))
  
  (defun sotlisp-find-or-define-function (&optional prefix)
@@@ -596,6 -598,7 +597,7 @@@ With a prefix argument, defines a `defv
    "Uncomment a sexp around point."
    (interactive "P")
    (let* ((initial-point (point-marker))
+          (inhibit-field-text-motion t)
           (p)
           (end (save-excursion
                  (when (elt (syntax-ppss) 4)
                  (point-marker)))
           (beg (save-excursion
                  (forward-line 0)
-                 (while (= end (save-excursion
-                                 (comment-forward (point-max))
-                                 (point)))
+                 (while (and (not (bobp))
+                             (= end (save-excursion
+                                      (comment-forward (point-max))
+                                      (point))))
                    (forward-line -1))
                  (goto-char (line-end-position))
                  (re-search-backward comment-start-skip
                                      (line-beginning-position)
                                      t)
-                 (while (looking-at-p comment-start-skip)
-                   (forward-char -1))
+                 (ignore-errors
+                   (while (looking-at comment-start-skip)
+                     (forward-char -1))
+                   (unless (looking-at "[\n\r[:blank]]")
+                     (forward-char 1)))
                  (point-marker))))
      (unless (= beg end)
        (uncomment-region beg end)
        (goto-char p)
        ;; Indentify the "top-level" sexp inside the comment.
-       (while (and (ignore-errors (backward-up-list) t)
-                   (>= (point) beg))
-         (skip-chars-backward (rx (syntax expression-prefix)))
-         (setq p (point-marker)))
+       (ignore-errors
+         (while (>= (point) beg)
+           (backward-prefix-chars)
+           (skip-chars-backward "\r\n[:blank:]")
+           (setq p (point-marker))
+           (backward-up-list)))
        ;; Re-comment everything before it. 
        (ignore-errors
          (comment-region beg p))
          ;; If this is a closing delimiter, pull it up.
          (goto-char end)
          (skip-chars-forward "\r\n[:blank:]")
-         (when (= 5 (car (syntax-after (point))))
+         (when (eq 5 (car (syntax-after (point))))
            (delete-indentation))))
      ;; Without a prefix, it's more useful to leave point where
      ;; it was.
@@@ -677,3 -686,4 +685,3 @@@ With a prefix argument N, (un)comment t
  
  (provide 'sotlisp)
  ;;; sotlisp.el ends here
 -