On 01/10/2011 09:32 PM, Denis Washington wrote:
Let me know if that fix the issue.

It does. So it's no typo after all... thanks for pointing this out.

Yeah, sorry for applying the patch too fast. I'm changing instead smalltalk-mode.el to use save-excursion. Since the original-point keyword argument is only used to restore it on exit, and it always does this, you can replace

  (if ...
        (progn (goto-char original-point) (point))
        (prog1 (point) (goto-char original-point)))

with

  (or (save-excursion
     (if ...
        nil
        (point)))
     (point)

(This seems more complicated, but the "if" is inside its own function so it's not bad).

Can anybody suggest a shortcut for smalltalk-goto-{previous,next}-keyword? It seems relatively useful even in day-to-day use.

Paolo
>From ce09b2f80c7ffe29983a44161f1deb1719366e1f Mon Sep 17 00:00:00 2001
From: Denis Washington <[email protected]>
Date: Mon, 10 Jan 2011 20:57:36 +0100
Subject: [PATCH] change defun* to defun

---
 smalltalk-mode.el |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/smalltalk-mode.el b/smalltalk-mode.el
index 0bd2711..e080806 100644
--- a/smalltalk-mode.el
+++ b/smalltalk-mode.el
@@ -1148,25 +1148,31 @@ Whitespace is defined as spaces, tabs, and comments."
 (defun smalltalk-goto-next-keyword ()
   (goto-char (smalltalk-next-keyword)))
 
-(defun* smalltalk-previous-keyword (&key (original-point (point)))
+(defun smalltalk-previous-keyword-1 ()
   (smalltalk-backward-whitespace)
-  (if (looking-back "[>[({.^]")
-      (progn (goto-char original-point) (point))
+  (if (looking-back "[>[({.^]") ;; not really ok when > is sent in a keyword 
arg
+      nil
     (progn 
       (smalltalk-safe-backward-sexp)
       (if (smalltalk-looking-at-keyword-send)
-         (prog1 (point) (goto-char original-point))
-       (smalltalk-previous-keyword :original-point original-point)))))
+         (point)
+       (smalltalk-previous-keyword-1)))))
 
-(defun* smalltalk-next-keyword (&key (original-point (point)))
+(defun smalltalk-next-keyword-1 ()
   (smalltalk-forward-whitespace)
   (if (looking-at "[])}.]")
-      (progn (goto-char original-point) (point))
+      nil
     (progn 
       (smalltalk-safe-forward-sexp)
       (skip-chars-forward ":")
       (if (smalltalk-looking-back-keyword-send)
-         (prog1 (point) (goto-char original-point))
-       (smalltalk-next-keyword :original-point original-point)))))
+         (point)
+       (smalltalk-next-keyword-1)))))
+
+(defun smalltalk-previous-keyword ()
+  (or (save-excursion (smalltalk-previous-keyword-1)) (point)))
+
+(defun smalltalk-next-keyword ()
+  (or (save-excursion (smalltalk-next-keyword-1)) (point)))
 
 (provide 'smalltalk-mode)
-- 
1.7.3.2

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to