[PATCH] Making smalltalk-mode.el available on Emacs package archives

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
Hi

There are various package archives available for distributing Emacs
packages, but
smalltalk-mode.el is not currently available on any of them.

The main issue is that smalltalk-mode.el does not have a valid package header or
footer. My patch below fixes this, and ensures the file can be used standalone.

I've also fixed some byte-compiler warnings.

You can see my patch as commits here:
https://github.com/Wilfred/gnu-smalltalk/compare/master...refactor_emacs_mode?expand=1

Thanks
Wilfred

Changes follow:

diff --git a/smalltalk-mode-init.el.in b/smalltalk-mode-init.el.in
index 0fc6321b..a2dbef9d 100644
--- a/smalltalk-mode-init.el.in
+++ b/smalltalk-mode-init.el.in
@@ -11,12 +11,9 @@
              (throw 'archive-mode (cdr mode-assoc))))))
       auto-mode-alist)

-(push '("\\.st\\'" . smalltalk-mode) auto-mode-alist)
-
 (if (boundp 'inhibit-local-variables-regexps)
     (push "\\.star\\'" inhibit-local-variables-regexps)
     (push "\\.star\\'" inhibit-first-line-modes-regexp))

-(autoload 'smalltalk-mode "@lispdir@/smalltalk-mode.elc" "" t)
 @WITH_EMACS_COMINT_TRUE@(autoload 'gst "@lispdir@/gst-mode.elc" "" t)

diff --git a/smalltalk-mode.el b/smalltalk-mode.el
index 14c74972..7f1f810c 100644
--- a/smalltalk-mode.el
+++ b/smalltalk-mode.el
@@ -1,3 +1,7 @@
+;;; smalltalk-mode.el --- Major mode for the Smalltalk programming language
+
+;;; Commentary:
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Copyright 1988-92, 1994-95, 1999, 2000, 2003, 2007, 2008, 2009
@@ -153,7 +157,7 @@
    '("#[A-z][A-z0-9_]*" . font-lock-constant-face)
    '("\\<[A-z][A-z0-9_]*:" . font-lock-function-name-face)
    (cons smalltalk-binsel 'font-lock-function-name-face)
-;   '("\\^" . font-lock-keyword-face)
+   '("\\^" . font-lock-keyword-face)
    '("\\$." . font-lock-string-face) ;; Chars
    '("\\<[A-Z]\\sw*\\>" . font-lock-type-face))
   "Basic Smalltalk keywords font-locking")
@@ -178,6 +182,7 @@

 ;; ---[ Interactive functions ]---------------------------------------

+;;;###autoload
 (defun smalltalk-mode ()
   "Major mode for editing Smalltalk code.

@@ -226,6 +231,9 @@ Commands:
   ;; Run hooks, must be last
   (run-hooks 'smalltalk-mode-hook))

+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.st\\'" . #'smalltalk-mode))
+
 (defun smalltalk-tab ()
   (interactive)
   (let (col)
@@ -417,7 +425,7 @@ expressions."

 (defun smalltalk-maybe-insert-spacing-line (n)
   (if (not (save-excursion
-         (previous-line n)
+         (forward-line (- n))
          (looking-at "^[ \t]*$")))
       (insert "\n")))

@@ -613,7 +621,7 @@ expressions."
     (and (= (preceding-char) ?|)
          (progn
            (backward-char 1)
-           (while (and (not (bobp)) (looking-back "[ \t\na-zA-Z]"))
+           (while (and (not (bobp)) (looking-back "[ \t\na-zA-Z]" nil))
          (skip-chars-backward " \t\n")
          (skip-chars-backward "a-zA-Z"))
            (if (= (preceding-char) ?|)
@@ -1026,22 +1034,23 @@ Whitespace is defined as spaces, tabs, and comments."
     (progn (setq curr-hit-point new-hit-point)
            (setq curr-hit new-hit)))
     (cons curr-hit curr-hit-point)))
-
+
+(defun smalltalk-update-hit-point (current search)
+  (save-excursion
+    (let ((new-hit-point (funcall search)))
+      (if (and new-hit-point
+               (or (not current) (> new-hit-point current)))
+          new-hit-point
+        current))))
+
 (defun smalltalk-current-scope-point ()
-  (defun smalltalk-update-hit-point (current search)
-    (save-excursion
-      (let ((new-hit-point (funcall search)))
-    (if (and new-hit-point
-         (or (not current) (> new-hit-point current)))
-        new-hit-point
-      current))))
   (let ((curr-hit-point (smalltalk-current-class-point)))
     (setq curr-hit-point
       (smalltalk-update-hit-point curr-hit-point
-                      #'(lambda ()(search-backward-regexp "^[
\t]*Eval[ \t]+\\[" nil t))))
+                      (lambda () (search-backward-regexp "^[
\t]*Eval[ \t]+\\[" nil t))))
     (setq curr-hit-point
       (smalltalk-update-hit-point curr-hit-point
-                      #'(lambda ()(search-backward-regexp "^[
\t]*Namespace[ \t]+current:[ \t]+[A-Za-z0-9_.]+[ \t]+\\[" nil t))))
+                      (lambda () (search-backward-regexp "^[
\t]*Namespace[ \t]+current:[ \t]+[A-Za-z0-9_.]+[ \t]+\\[" nil t))))
     curr-hit-point))

 (defun smalltalk-current-class-point ()
@@ -1115,13 +1124,13 @@ Whitespace is defined as spaces, tabs, and comments."
       (error (goto-char prev-point)))))

 (defun smalltalk-goto-beginning-of-statement ()
-  (if (not (looking-back "[ \t\n]"))
+  (if (not (looking-back "[ \t\n]" nil nil))
       (smalltalk-safe-backward-sexp)))

 (defun smalltalk-has-sender ()
   (save-excursion
     (smalltalk-backward-whitespace)
-    (looking-back "[]})A-Za-z0-9']")))
+    (looking-back "[]})A-Za-z0-9']" nil)))

 (defun smalltalk-looking-at-binary-send ()
   (looking-at "[^]A-Za-z0-9:_(){}[;.\'\"]+[ \t\n]"))
@@ -1133,7 +1142,7 @@ Whitespace is defined as spaces, tabs, and comments."
   (looking-at "[A-Za-z][A-Za-z0-9_]*:"))

 (defun smalltalk-looking-back-keyword-send ()
-  (looking-back "[A-z][A-z0-9_]*:"))
+  (looking-back "[A-z][A-z0-9_]*:" nil))

 (defun smalltalk-find-end-of-keyword-send ()
   (save-excursion
@@ -1150,8 +1159,8 @@ Whitespace is defined as spaces, tabs, and comments."
     (let ((begin-of-defun (smalltalk-at-begin-of-defun)))
       (smalltalk-backward-whitespace)
       (if (or (if begin-of-defun
-          (looking-back "[].;]")
-        (looking-back "[.;]"))
+          (looking-back "[].;]" nil)
+        (looking-back "[.;]" nil))
           (= (smalltalk-previous-keyword) (point)))
       ""
     (progn
@@ -1169,7 +1178,7 @@ Whitespace is defined as spaces, tabs, and comments."

 (defun smalltalk-previous-keyword-1 ()
   (smalltalk-backward-whitespace)
-  (if (looking-back "[>[({.^]") ;; not really ok when > is sent in a
keyword arg
+  (if (looking-back "[>[({.^]" nil) ;; not really ok when > is sent
in a keyword arg
       nil
     (if (= (point) (save-excursion (smalltalk-safe-backward-sexp) (point)))
     nil
@@ -1200,3 +1209,4 @@ Whitespace is defined as spaces, tabs, and comments."

 (provide 'smalltalk-mode)

+;;; smalltalk-mode.el ends here

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
I've realised I made I mistake in the auto-mode-alist. I've attached
the latest version of my patch.

I already have FSF copyright papers signed, so this should be ready to
merge. Let me know what you think.

On 13 August 2017 at 11:59, Wilfred Hughes <[hidden email]> wrote:

> Hi
>
> There are various package archives available for distributing Emacs
> packages, but
> smalltalk-mode.el is not currently available on any of them.
>
> The main issue is that smalltalk-mode.el does not have a valid package header or
> footer. My patch below fixes this, and ensures the file can be used standalone.
>
> I've also fixed some byte-compiler warnings.
>
> You can see my patch as commits here:
> https://github.com/Wilfred/gnu-smalltalk/compare/master...refactor_emacs_mode?expand=1
>
> Thanks
> Wilfred
>
> Changes follow:
>
> diff --git a/smalltalk-mode-init.el.in b/smalltalk-mode-init.el.in
> index 0fc6321b..a2dbef9d 100644
> --- a/smalltalk-mode-init.el.in
> +++ b/smalltalk-mode-init.el.in
> @@ -11,12 +11,9 @@
>               (throw 'archive-mode (cdr mode-assoc))))))
>        auto-mode-alist)
>
> -(push '("\\.st\\'" . smalltalk-mode) auto-mode-alist)
> -
>  (if (boundp 'inhibit-local-variables-regexps)
>      (push "\\.star\\'" inhibit-local-variables-regexps)
>      (push "\\.star\\'" inhibit-first-line-modes-regexp))
>
> -(autoload 'smalltalk-mode "@lispdir@/smalltalk-mode.elc" "" t)
>  @WITH_EMACS_COMINT_TRUE@(autoload 'gst "@lispdir@/gst-mode.elc" "" t)
>
> diff --git a/smalltalk-mode.el b/smalltalk-mode.el
> index 14c74972..7f1f810c 100644
> --- a/smalltalk-mode.el
> +++ b/smalltalk-mode.el
> @@ -1,3 +1,7 @@
> +;;; smalltalk-mode.el --- Major mode for the Smalltalk programming language
> +
> +;;; Commentary:
> +
>  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>  ;;;
>  ;;; Copyright 1988-92, 1994-95, 1999, 2000, 2003, 2007, 2008, 2009
> @@ -153,7 +157,7 @@
>     '("#[A-z][A-z0-9_]*" . font-lock-constant-face)
>     '("\\<[A-z][A-z0-9_]*:" . font-lock-function-name-face)
>     (cons smalltalk-binsel 'font-lock-function-name-face)
> -;   '("\\^" . font-lock-keyword-face)
> +   '("\\^" . font-lock-keyword-face)
>     '("\\$." . font-lock-string-face) ;; Chars
>     '("\\<[A-Z]\\sw*\\>" . font-lock-type-face))
>    "Basic Smalltalk keywords font-locking")
> @@ -178,6 +182,7 @@
>
>  ;; ---[ Interactive functions ]---------------------------------------
>
> +;;;###autoload
>  (defun smalltalk-mode ()
>    "Major mode for editing Smalltalk code.
>
> @@ -226,6 +231,9 @@ Commands:
>    ;; Run hooks, must be last
>    (run-hooks 'smalltalk-mode-hook))
>
> +;;;###autoload
> +(add-to-list 'auto-mode-alist '("\\.st\\'" . #'smalltalk-mode))
> +
>  (defun smalltalk-tab ()
>    (interactive)
>    (let (col)
> @@ -417,7 +425,7 @@ expressions."
>
>  (defun smalltalk-maybe-insert-spacing-line (n)
>    (if (not (save-excursion
> -         (previous-line n)
> +         (forward-line (- n))
>           (looking-at "^[ \t]*$")))
>        (insert "\n")))
>
> @@ -613,7 +621,7 @@ expressions."
>      (and (= (preceding-char) ?|)
>           (progn
>             (backward-char 1)
> -           (while (and (not (bobp)) (looking-back "[ \t\na-zA-Z]"))
> +           (while (and (not (bobp)) (looking-back "[ \t\na-zA-Z]" nil))
>           (skip-chars-backward " \t\n")
>           (skip-chars-backward "a-zA-Z"))
>             (if (= (preceding-char) ?|)
> @@ -1026,22 +1034,23 @@ Whitespace is defined as spaces, tabs, and comments."
>      (progn (setq curr-hit-point new-hit-point)
>             (setq curr-hit new-hit)))
>      (cons curr-hit curr-hit-point)))
> -
> +
> +(defun smalltalk-update-hit-point (current search)
> +  (save-excursion
> +    (let ((new-hit-point (funcall search)))
> +      (if (and new-hit-point
> +               (or (not current) (> new-hit-point current)))
> +          new-hit-point
> +        current))))
> +
>  (defun smalltalk-current-scope-point ()
> -  (defun smalltalk-update-hit-point (current search)
> -    (save-excursion
> -      (let ((new-hit-point (funcall search)))
> -    (if (and new-hit-point
> -         (or (not current) (> new-hit-point current)))
> -        new-hit-point
> -      current))))
>    (let ((curr-hit-point (smalltalk-current-class-point)))
>      (setq curr-hit-point
>        (smalltalk-update-hit-point curr-hit-point
> -                      #'(lambda ()(search-backward-regexp "^[
> \t]*Eval[ \t]+\\[" nil t))))
> +                      (lambda () (search-backward-regexp "^[
> \t]*Eval[ \t]+\\[" nil t))))
>      (setq curr-hit-point
>        (smalltalk-update-hit-point curr-hit-point
> -                      #'(lambda ()(search-backward-regexp "^[
> \t]*Namespace[ \t]+current:[ \t]+[A-Za-z0-9_.]+[ \t]+\\[" nil t))))
> +                      (lambda () (search-backward-regexp "^[
> \t]*Namespace[ \t]+current:[ \t]+[A-Za-z0-9_.]+[ \t]+\\[" nil t))))
>      curr-hit-point))
>
>  (defun smalltalk-current-class-point ()
> @@ -1115,13 +1124,13 @@ Whitespace is defined as spaces, tabs, and comments."
>        (error (goto-char prev-point)))))
>
>  (defun smalltalk-goto-beginning-of-statement ()
> -  (if (not (looking-back "[ \t\n]"))
> +  (if (not (looking-back "[ \t\n]" nil nil))
>        (smalltalk-safe-backward-sexp)))
>
>  (defun smalltalk-has-sender ()
>    (save-excursion
>      (smalltalk-backward-whitespace)
> -    (looking-back "[]})A-Za-z0-9']")))
> +    (looking-back "[]})A-Za-z0-9']" nil)))
>
>  (defun smalltalk-looking-at-binary-send ()
>    (looking-at "[^]A-Za-z0-9:_(){}[;.\'\"]+[ \t\n]"))
> @@ -1133,7 +1142,7 @@ Whitespace is defined as spaces, tabs, and comments."
>    (looking-at "[A-Za-z][A-Za-z0-9_]*:"))
>
>  (defun smalltalk-looking-back-keyword-send ()
> -  (looking-back "[A-z][A-z0-9_]*:"))
> +  (looking-back "[A-z][A-z0-9_]*:" nil))
>
>  (defun smalltalk-find-end-of-keyword-send ()
>    (save-excursion
> @@ -1150,8 +1159,8 @@ Whitespace is defined as spaces, tabs, and comments."
>      (let ((begin-of-defun (smalltalk-at-begin-of-defun)))
>        (smalltalk-backward-whitespace)
>        (if (or (if begin-of-defun
> -          (looking-back "[].;]")
> -        (looking-back "[.;]"))
> +          (looking-back "[].;]" nil)
> +        (looking-back "[.;]" nil))
>            (= (smalltalk-previous-keyword) (point)))
>        ""
>      (progn
> @@ -1169,7 +1178,7 @@ Whitespace is defined as spaces, tabs, and comments."
>
>  (defun smalltalk-previous-keyword-1 ()
>    (smalltalk-backward-whitespace)
> -  (if (looking-back "[>[({.^]") ;; not really ok when > is sent in a
> keyword arg
> +  (if (looking-back "[>[({.^]" nil) ;; not really ok when > is sent
> in a keyword arg
>        nil
>      (if (= (point) (save-excursion (smalltalk-safe-backward-sexp) (point)))
>      nil
> @@ -1200,3 +1209,4 @@ Whitespace is defined as spaces, tabs, and comments."
>
>  (provide 'smalltalk-mode)
>
> +;;; smalltalk-mode.el ends here

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

emacs_mode.diff (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
I've received some more feedback from Emacs people about the header
formatting on my patch, so here's an updated version. Would anyone be
able to apply this?

On 22 August 2017 at 00:00, Wilfred Hughes <[hidden email]> wrote:

>
> I've realised I made I mistake in the auto-mode-alist. I've attached
> the latest version of my patch.
>
> I already have FSF copyright papers signed, so this should be ready to
> merge. Let me know what you think.
>
> On 13 August 2017 at 11:59, Wilfred Hughes <[hidden email]> wrote:
> > Hi
> >
> > There are various package archives available for distributing Emacs
> > packages, but
> > smalltalk-mode.el is not currently available on any of them.
> >
> > The main issue is that smalltalk-mode.el does not have a valid package header or
> > footer. My patch below fixes this, and ensures the file can be used standalone.
> >
> > I've also fixed some byte-compiler warnings.
> >
> > You can see my patch as commits here:
> > https://github.com/Wilfred/gnu-smalltalk/compare/master...refactor_emacs_mode?expand=1
> >
> > Thanks
> > Wilfred

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

emacs_mode.diff (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

Holger Freyther

> On 27. Aug 2017, at 03:12, Wilfred Hughes <[hidden email]> wrote:
>

Dear Wilfred,


> I've received some more feedback from Emacs people about the header
> formatting on my patch, so here's an updated version. Would anyone be
> able to apply this?


thank you for your contribution. I was busy with relocation and I am not am Emacs user and not good in Lisp. I had hoped someone else would comment. I am traveling right now but then will check fencepost for the copyright assignment and apply your change.


holger



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

Holger Freyther
In reply to this post by WilfredHughes

> On 27. Aug 2017, at 03:12, Wilfred Hughes <[hidden email]> wrote:
>

Dear Wilfred,


> I've received some more feedback from Emacs people about the header
> formatting on my patch, so here's an updated version. Would anyone be
> able to apply this?


thank you for your contribution. I was busy with relocation and I am not am Emacs user and not good in Lisp. I had hoped someone else would comment. I am traveling right now but then will check fencepost for the copyright assignment and apply your change.


holger



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
In reply to this post by Holger Freyther
Hi Holger

Thanks for your response. My patch has been reviewed by Tarsius, a
very experience Emacs person, so it's had some review (and hence the
third version of my patch!).

I have sent patches to GNU Emacs and GNU Guile in the past, so my
details should be fencepost.

Wilfred

On 27 August 2017 at 12:08, Holger Freyther <[hidden email]> wrote:

>
>> On 27. Aug 2017, at 03:12, Wilfred Hughes <[hidden email]> wrote:
>>
>
> Dear Wilfred,
>
>
>> I've received some more feedback from Emacs people about the header
>> formatting on my patch, so here's an updated version. Would anyone be
>> able to apply this?
>
>
> thank you for your contribution. I was busy with relocation and I am not am Emacs user and not good in Lisp. I had hoped someone else would comment. I am traveling right now but then will check fencepost for the copyright assignment and apply your change.
>
>
> holger
>
>

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

Holger Freyther
In reply to this post by WilfredHughes

> On 13. Aug 2017, at 12:59, Wilfred Hughes <[hidden email]> wrote:


Hi Wilfred,


> You can see my patch as commits here:
> https://github.com/Wilfred/gnu-smalltalk/compare/master...refactor_emacs_mode?expand=1


sorry for the delay. Is this still the most recent branch? I would like to take the individual commits.

thank you

        holger
_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
Yep, that's the most recent branch (it's the only branch).

On 7 Sep 2017 4:51 pm, "Holger Freyther" <[hidden email]> wrote:


> On 13. Aug 2017, at 12:59, Wilfred Hughes <[hidden email]> wrote:


Hi Wilfred,


> You can see my patch as commits here:
> https://github.com/Wilfred/gnu-smalltalk/compare/master..
.refactor_emacs_mode?expand=1


sorry for the delay. Is this still the most recent branch? I would like to
take the individual commits.

thank you

        holger
_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

Nicolas Petton-3
In reply to this post by Holger Freyther
Holger Freyther <[hidden email]> writes:

> thank you for your contribution. I was busy with relocation and I am
> not am Emacs user and not good in Lisp. I had hoped someone else would
> comment. I am traveling right now but then will check fencepost for
> the copyright assignment and apply your change.

Hi Holger,

The patch looks good to me.

Cheers,
Nico

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

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Making smalltalk-mode.el available on Emacs package archives

WilfredHughes
In reply to this post by Holger Freyther
Good news! I have got copyright assignment sorted out for GNU Smalltalk. :)

Do we need anything else to land the patch?

Thanks
Wilfred

On 27 Aug 2017 12:08 pm, "Holger Freyther" <[hidden email]> wrote:

>
> > On 27. Aug 2017, at 03:12, Wilfred Hughes <[hidden email]> wrote:
> >
>
> Dear Wilfred,
>
>
> > I've received some more feedback from Emacs people about the header
> > formatting on my patch, so here's an updated version. Would anyone be
> > able to apply this?
>
>
> thank you for your contribution. I was busy with relocation and I am not
> am Emacs user and not good in Lisp. I had hoped someone else would comment.
> I am traveling right now but then will check fencepost for the copyright
> assignment and apply your change.
>
>
> holger
>
>
>
_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk