unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14732: Package dos-mode for ELPA
@ 2013-06-27 16:15 Arni Magnusson
  2013-06-27 17:40 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Arni Magnusson @ 2013-06-27 16:15 UTC (permalink / raw)
  To: 14732

Dear ELPA maintainers,

I would like to submit

   http://www.emacswiki.org/emacs/download/dos-indent.el

to the ELPA repository. Please advise whether I can help with the 
procedure.

Thanks,

Arni





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-06-27 16:15 bug#14732: Package dos-mode for ELPA Arni Magnusson
@ 2013-06-27 17:40 ` Eli Zaretskii
  2013-07-01  1:00 ` Arni Magnusson
  2013-08-08  3:40 ` Glenn Morris
  2 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2013-06-27 17:40 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 14732

> Date: Thu, 27 Jun 2013 16:15:21 +0000 (GMT)
> From: Arni Magnusson <arnima@hafro.is>
> 
> I would like to submit
> 
>    http://www.emacswiki.org/emacs/download/dos-indent.el
> 
> to the ELPA repository. Please advise whether I can help with the 
> procedure.

Thank you.

I would like to comment on this package:

 . it calls itself dos.el inside the source

 . why not add this stuff to the existing bat-generic mode?





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-06-27 16:15 bug#14732: Package dos-mode for ELPA Arni Magnusson
  2013-06-27 17:40 ` Eli Zaretskii
@ 2013-07-01  1:00 ` Arni Magnusson
  2013-07-01 10:44   ` Arni Magnusson
  2013-07-01 16:50   ` Eli Zaretskii
  2013-08-08  3:40 ` Glenn Morris
  2 siblings, 2 replies; 31+ messages in thread
From: Arni Magnusson @ 2013-07-01  1:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14732

Thank you for the feedback.

I did indeed paste the wrong URL - the correct one is:

   http://www.emacswiki.org/emacs/download/dos.el

As for the second point (why not add to `bat-generic-mode'), I have two 
answers, so please pick the one you prefer:


(1) I would be honored to prepare a patch to improve the syntax 
highlighting of `bat-generic-mode'. This patch would be based on existing 
functionality in `dos-mode' and would provide:

- highlighting of more commands: at attrib color date dir doskey endlocal 
erase fc find mkdir more move popd pushd rmdir setlocal sort time title 
type xcopy

- highlighting of more control flow keywords: cmd defined else equ exit 
geq gtr in leq lss neq

- highlighting of called script: call foo

- highlighting of %%variable: for %%X in (bark meow) do echo %%X

- highlighting of defined variable: if defined VAR


(2) There is more to `dos-mode' than syntax highlighting. Perhaps it would 
make Emacs users happy to introduce progmodes/dos.el and obsolete 
`bat-generic-mode' in the same elegant way as `javascript-generic-mode' 
invokes `js-mode'.

This would provide users with a dedicated menu, providing helpful commands 
like `dos-help-cmd', `dos-run-args', and `dos-template'.

This might also make it easier for users to discover this functionality in 
Emacs. Notice that for over 4 years, there has been a discussion on 
http://www.emacswiki.org/emacs/DosScripts, without anyone mentioning 
`bat-generic-mode', perhaps because they were not aware of its existence.

When writing `dos-mode' I tried to follow the examples set by flagship 
modes like c-mode, emacs-lisp-mode, and fortran-mode. I would be happy to 
make any changes that the Emacs core developers suggest.


All the best,

Arni



On Thu, 27 Jun 2013, Eli Zaretskii wrote:

Thank you.

I would like to comment on this package:

  . it calls itself dos.el inside the source

  . why not add this stuff to the existing bat-generic mode?



On Thu, 27 Jun 2013, Arni Magnusson wrote:

> I would like to submit
>
>    http://www.emacswiki.org/emacs/download/dos-indent.el
>
> to the ELPA repository. Please advise whether I can help with the 
> procedure.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-01  1:00 ` Arni Magnusson
@ 2013-07-01 10:44   ` Arni Magnusson
  2013-07-01 16:50   ` Eli Zaretskii
  1 sibling, 0 replies; 31+ messages in thread
From: Arni Magnusson @ 2013-07-01 10:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14732

I just committed some minor improvements to 
http://www.emacswiki.org/emacs/dos.el. From the ;;; History section:

;;  1 Ju1 2013  2.20 Renamed user function `dos-help-cmd' to
;;                   `dos-cmd-help', and `dos-help-mode' to
;;                   `dos-mode-help'. Improved `dos-cmd-help'.
;;                   Added keywords "net" and "rename".
;;                   Improved documentation.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-01  1:00 ` Arni Magnusson
  2013-07-01 10:44   ` Arni Magnusson
@ 2013-07-01 16:50   ` Eli Zaretskii
  2013-07-01 23:30     ` Stefan Monnier
  1 sibling, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2013-07-01 16:50 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 14732

> Date: Mon, 1 Jul 2013 01:00:02 +0000 (GMT)
> From: Arni Magnusson <arnima@hafro.is>
> cc: 14732@debbugs.gnu.org
> 
> As for the second point (why not add to `bat-generic-mode'), I have two 
> answers, so please pick the one you prefer:
> 
> 
> (1) I would be honored to prepare a patch to improve the syntax 
> highlighting of `bat-generic-mode'. This patch would be based on existing 
> functionality in `dos-mode' and would provide:
> 
> - highlighting of more commands: at attrib color date dir doskey endlocal 
> erase fc find mkdir more move popd pushd rmdir setlocal sort time title 
> type xcopy
> 
> - highlighting of more control flow keywords: cmd defined else equ exit 
> geq gtr in leq lss neq
> 
> - highlighting of called script: call foo
> 
> - highlighting of %%variable: for %%X in (bark meow) do echo %%X
> 
> - highlighting of defined variable: if defined VAR

I think we prefer this alternative, thanks.  However, to accept such
changes into Emacs, you will need to do legal paperwork, as I don't
see your assignment for Emacs on file at this time.

> (2) There is more to `dos-mode' than syntax highlighting. Perhaps it would 
> make Emacs users happy to introduce progmodes/dos.el and obsolete 
> `bat-generic-mode' in the same elegant way as `javascript-generic-mode' 
> invokes `js-mode'.

There's no need to obsolete a mode, as it isn't doing anything wrong.
It just has only a small number of features.

> This might also make it easier for users to discover this functionality in 
> Emacs. Notice that for over 4 years, there has been a discussion on 
> http://www.emacswiki.org/emacs/DosScripts, without anyone mentioning 
> `bat-generic-mode', perhaps because they were not aware of its existence.

Then I guess we will have to make a better marketing effort this
time.  For example, we could make bat-generic-mode be the default mode
for Windows batch files, which will make users acutely aware of it.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-01 16:50   ` Eli Zaretskii
@ 2013-07-01 23:30     ` Stefan Monnier
  2013-07-02  0:12       ` Arni Magnusson
  2013-07-07 12:34       ` Arni Magnusson
  0 siblings, 2 replies; 31+ messages in thread
From: Stefan Monnier @ 2013-07-01 23:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Arni Magnusson, 14732

>> (1) I would be honored to prepare a patch to improve the syntax 
>> highlighting of `bat-generic-mode'. This patch would be based on existing 
>> functionality in `dos-mode' and would provide:
>> - highlighting of more commands: at attrib color date dir doskey endlocal 
>> erase fc find mkdir more move popd pushd rmdir setlocal sort time title 
>> type xcopy
>> - highlighting of more control flow keywords: cmd defined else equ exit 
>> geq gtr in leq lss neq
>> - highlighting of called script: call foo
>> - highlighting of %%variable: for %%X in (bark meow) do echo %%X
>> - highlighting of defined variable: if defined VAR

> I think we prefer this alternative, thanks.

Actually, I don't: I really dislike define-generic-mode, so while it's
OK to extend bat-generic-mode, the better way to do it is to define it
with define-derived-mode (at which point having "generic" in the name
makes no sense).


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-01 23:30     ` Stefan Monnier
@ 2013-07-02  0:12       ` Arni Magnusson
  2013-08-05  0:16         ` Stefan Monnier
  2013-07-07 12:34       ` Arni Magnusson
  1 sibling, 1 reply; 31+ messages in thread
From: Arni Magnusson @ 2013-07-02  0:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14732

> However, to accept such changes into Emacs, you will need to do legal 
> paperwork

Great. I have signed an FSF agreement regarding Texinfo, and I'm more than 
willing to do the same for Emacs.

If bolstering `bat-generic-mode' is not the best option, I would be 
equally happy to prepare a derived mode and call it something like 
`bat-mode' or `dos-mode'. If we select the best parts from my current 
http://www.emacswiki.org/emacs/download/dos.el, I will scrap the old 
remains, so we probably wouldn't have to worry about a name clash.

It seems like deriving from `prog-mode' might be a good design option, 
since that's what `sh-mode' is derived from.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-01 23:30     ` Stefan Monnier
  2013-07-02  0:12       ` Arni Magnusson
@ 2013-07-07 12:34       ` Arni Magnusson
  2013-07-10  0:43         ` Arni Magnusson
  1 sibling, 1 reply; 31+ messages in thread
From: Arni Magnusson @ 2013-07-07 12:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14732

As suggested by Stefan, I have defined an improved mode for editing Dos 
scripts using `define-derived-mode'. I have uploaded it to

   http://www.emacswiki.org/emacs/download/dos.el

The new `dos-mode' is a complete rewrite of my old one, considerably 
simplified (now 5857 bytes) after stripping away features that probably 
belong in user hooks.

As indicated by the header comment "This file is part of GNU Emacs.", I am 
hoping that `dos-mode' will be incorporated into core Emacs, inside 
lisp/progmodes.

The old `bat-generic-mode' could link to `dos-mode' in the same way as 
`javascript-generic-mode' links to `js-mode'.

Please feel free to make any modifications or suggestions.

Arni





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-07 12:34       ` Arni Magnusson
@ 2013-07-10  0:43         ` Arni Magnusson
  0 siblings, 0 replies; 31+ messages in thread
From: Arni Magnusson @ 2013-07-10  0:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14732

Would it be better if I submit/test the proposed dos.el in some other way? 
I have not used bzr or Savannah, but I see there are instructions online.

I'll be attending a statistics conference in Boston next week, and I'd be 
happy to drop by the FSF office to assign the copyright to them.

Arni





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-07-02  0:12       ` Arni Magnusson
@ 2013-08-05  0:16         ` Stefan Monnier
  2013-08-05  2:20           ` Arni Magnusson
  0 siblings, 1 reply; 31+ messages in thread
From: Stefan Monnier @ 2013-08-05  0:16 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 14732

[ Slowly going back over some of that email backlog. ]

> http://www.emacswiki.org/emacs/download/dos.el

Thanks you.  The code looks ready for ELPA (I'd use call-process a bit
more often than shell-command, to avoid quoting issues, tho).

It would be nice to add some SMIE support to it.

>> However, to accept such changes into Emacs, you will need to do legal
>> paperwork
> Great. I have signed an FSF agreement regarding Texinfo, and I'm more than
> willing to do the same for Emacs.

Have you started this process?
If not, then please fill the form below and email it as instructed so
the FSF can send you the relevant paperwork to sign.


        Stefan


Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]


[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]


[For the copyright registration, what country are you a citizen of?]


[What year were you born?]


[Please write your email address here.]


[Please write your postal address here.]





[Which files have you changed so far, and which new files have you written
so far?]





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-05  0:16         ` Stefan Monnier
@ 2013-08-05  2:20           ` Arni Magnusson
  2013-08-06 21:00             ` Stefan Monnier
  0 siblings, 1 reply; 31+ messages in thread
From: Arni Magnusson @ 2013-08-05  2:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14732

Hi Stefan,

Do you think that `dos-mode' could perhaps make it to Emacs core (i.e. 
lisp/progmodes) instead of becoming an optional ELPA download?

The current `bat-generic-mode' provides surprisingly limited 
syntax-highlighting, and earlier we discussed that instead of submitting a 
patch for the generic mode, it would be better if I rewrite it as a 
derived mode. While doing that, my design goal was to write a minimalistic 
replacement of `bat-generic-mode' with the following improvements:

- highlighting of more commands: at attrib color date dir doskey endlocal 
erase fc find mkdir more move popd pushd rmdir setlocal sort time title 
type xcopy

- highlighting of more control flow keywords: cmd defined else equ exit 
geq gtr in leq lss neq

- highlighting of called script: call foo

- highlighting of %%variable: for %%X in (bark meow) do echo %%X

- highlighting of defined variable: if defined VAR

I studied other code inside progmodes to use a similar style, both 
internally and in the user interface, which has a menu with a few basic 
but useful commands.

At 6333 bytes, I think it is a substantial improvement in Emacs support 
for Dos scripts. I believe it would make many Emacs users happy to have 
`auto-mode-alist' turn on `dos-mode' for the "bat" filename extension. 
Actually, the net increase in code should be less than 6333 bytes, because 
almost all remnants of `bat-generic-mode' could be deleted.

An analogous improvement was when `js-mode' replaced the old 
`javascript-generic-mode'.

I would of course be fine with `dos-mode' being an ELPA package (my 
initial proposal), but I just think Emacs should out-of-the-box have 
slightly better support for editing Dos scripts. They are an unpopular but 
necessary part of many free software projects, and developers would 
appreciate to at least see the common Dos keywords colored.

Perhaps ELPA could be a stepping stone towards the venerable progmodes? A 
kind of a review process and a general call for a SMIE patch? In that 
case, we should probably change the header comment "This file is part of 
GNU Emacs". Just to be explicit, I'm happy to have the Emacs developers 
make any changes to the proposed 
http://www.emacswiki.org/emacs/download/dos.el.

All the best,

Arni

P.S. I have received and signed the copyright assignment, and mailed it to 
the Assignment Administrator (D. Robertson) on 25 July.



On Sun, 4 Aug 2013, Stefan Monnier wrote:

> [ Slowly going back over some of that email backlog. ]
>
>> http://www.emacswiki.org/emacs/download/dos.el
>
> Thanks you.  The code looks ready for ELPA (I'd use call-process a bit 
> more often than shell-command, to avoid quoting issues, tho).
>
> It would be nice to add some SMIE support to it.
>
>>> However, to accept such changes into Emacs, you will need to do legal 
>>> paperwork
>>
>> Great. I have signed an FSF agreement regarding Texinfo, and I'm more 
>> than willing to do the same for Emacs.
>
> Have you started this process? If not, then please fill the form below 
> and email it as instructed so the FSF can send you the relevant 
> paperwork to sign.
>
>
>        Stefan
>





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-05  2:20           ` Arni Magnusson
@ 2013-08-06 21:00             ` Stefan Monnier
  2013-08-07 15:54               ` Stefan Monnier
  0 siblings, 1 reply; 31+ messages in thread
From: Stefan Monnier @ 2013-08-06 21:00 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 14732

> Do you think that `dos-mode' could perhaps make it to Emacs core
> (i.e. lisp/progmodes) instead of becoming an optional ELPA download?

Oh, yes, right, that was the plan.

> P.S. I have received and signed the copyright assignment, and mailed it to
> the Assignment Administrator (D. Robertson) on 25 July.

Great, so we're just waiting for the paperwork to get through.


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-06 21:00             ` Stefan Monnier
@ 2013-08-07 15:54               ` Stefan Monnier
  2013-08-07 16:14                 ` Eli Zaretskii
  2013-08-07 17:26                 ` Juanma Barranquero
  0 siblings, 2 replies; 31+ messages in thread
From: Stefan Monnier @ 2013-08-07 15:54 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 14732

OK, so I just installed your code into trunk.  Thank you.
I also added the patch below to it.  I recommend you check my patch
(100% untested), especially the FIXMEs.
Also, I wonder now if we shouldn't rename it to bat-mode.
After all, I expect most users of this mode don't use DOS, many of them
may not even know what DOS really is.  And the old name was
bat-generic-mode.

Send patches to bug-gnu-emacs, and/or ask write-access to the
repository (by requesting the become a member of the "emacs" group from
your savannah account).


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 15:54               ` Stefan Monnier
@ 2013-08-07 16:14                 ` Eli Zaretskii
  2013-08-07 17:27                   ` Stefan Monnier
  2013-08-07 17:26                 ` Juanma Barranquero
  1 sibling, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-07 16:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: arnima, 14732

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz@gnu.org>,  14732@debbugs.gnu.org
> Date: Wed, 07 Aug 2013 11:54:02 -0400
> 
> OK, so I just installed your code into trunk.  Thank you.
> I also added the patch below to it.

I found no patch attached.

> Also, I wonder now if we shouldn't rename it to bat-mode.

Definitely.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 15:54               ` Stefan Monnier
  2013-08-07 16:14                 ` Eli Zaretskii
@ 2013-08-07 17:26                 ` Juanma Barranquero
  2013-08-07 18:11                   ` Stefan Monnier
  1 sibling, 1 reply; 31+ messages in thread
From: Juanma Barranquero @ 2013-08-07 17:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Arni Magnusson, 14732

On Wed, Aug 7, 2013 at 5:54 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Also, I wonder now if we shouldn't rename it to bat-mode.
> After all, I expect most users of this mode don't use DOS, many of them
> may not even know what DOS really is.

Of course, I suppose that if I try to add support (font-locking.
mostly) for TCC, the proprietary command interpreter part of
TakeCommand, I will be shoot down, even if CMD itself is not exactly
free software...

   J





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 16:14                 ` Eli Zaretskii
@ 2013-08-07 17:27                   ` Stefan Monnier
  0 siblings, 0 replies; 31+ messages in thread
From: Stefan Monnier @ 2013-08-07 17:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: arnima, 14732

>> OK, so I just installed your code into trunk.  Thank you.
>> I also added the patch below to it.
> I found no patch attached.

What are you, blind?  Look again!


        Stefan "Geez!"


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-08-07 15:43:57 +0000
+++ lisp/ChangeLog	2013-08-07 15:50:16 +0000
@@ -1,3 +1,10 @@
+2013-08-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/dos.el (auto-mode-alist): Add entries for dos-mode.
+	(dos-mode): Use setq-local.  Add space after "rem".
+	(dos-mode-syntax-table): Don't use "w" for symbol chars.
+	(dos-font-lock-keywords): Try to adjust font-lock rules accordingly.
+
 2013-08-07  Arni Magnusson  <arnima@hafro.is>
 
 	* progmodes/dos.el: New file.

=== modified file 'lisp/progmodes/dos.el'
--- lisp/progmodes/dos.el	2013-08-07 15:43:57 +0000
+++ lisp/progmodes/dos.el	2013-08-07 15:50:16 +0000
@@ -79,24 +79,25 @@
              "goto" "gtr" "if" "in" "leq" "lss" "neq" "not" "start"))
           (LINUX
            '("cat" "cp" "ls" "mv" "rm")))
-      (list
-       '("\\<\\(call\\|goto\\)\\>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?"
+      `(("\\<_\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?"
          (2 font-lock-constant-face t))
-       '("^[ \t]*\\(@?rem\\>\\|::\\).*"
+        ("^[ \t]*\\(@?rem\\_>\\|::\\).*"
          (0 font-lock-comment-face t))
-       '("^:[^:].*"
+        ("^:[^:].*"
          . 'dos-label-face)
-       '("\\<\\(defined\\|set\\)\\>[ \t]*\\(\\w+\\)"
+        ("\\<_\\(defined\\|set\\)\\_>[ \t]*\\(\\w+\\)"
          (2 font-lock-variable-name-face))
-       '("%\\(\\w+\\)%?"
+        ("%\\(\\w+\\)%?"
          (1 font-lock-variable-name-face))
-       '("!\\(\\w+\\)!?" ; delayed-expansion !variable!
+        ("!\\(\\w+\\)!?"                ; delayed-expansion !variable!
          (1 font-lock-variable-name-face))
-       '("[ =][-/]+\\(\\w+\\)"
+        ("[ =][-/]+\\(\\w+\\)"
          (1 font-lock-type-face append))
-       (cons (regexp-opt COMMANDS 'words) font-lock-builtin-face)
-       (cons (regexp-opt CONTROLFLOW 'words) font-lock-keyword-face)
-       (cons (regexp-opt LINUX 'words) font-lock-warning-face)))))
+        (,(concat "\\_<" (regexp-opt COMMANDS) "\\_>") . font-lock-builtin-face)
+        (,(concat "\\_<" (regexp-opt CONTROLFLOW) "\\_>")
+         . font-lock-keyword-face)
+        (,(concat "\\_<" (regexp-opt LINUX) "\\_>")
+         . font-lock-warning-face)))))
 
 (defvar dos-menu
   '("Dos"
@@ -114,7 +115,7 @@
   (let ((map (make-sparse-keymap)))
     (easy-menu-define nil map nil dos-menu)
     (define-key map [?\C-c ?\C-.] 'dos-mode-help)
-    (define-key map [?\C-c ?\C-/] 'dos-cmd-help)
+    (define-key map [?\C-c ?\C-/] 'dos-cmd-help) ;FIXME: Why not C-c C-? ?
     (define-key map [?\C-c ?\C-a] 'dos-run-args)
     (define-key map [?\C-c ?\C-c] 'dos-run)
     (define-key map [?\C-c ?\C-t] 'dos-template)
@@ -123,21 +124,24 @@
 
 (defvar dos-mode-syntax-table
   (let ((table (make-syntax-table)))
-    (modify-syntax-entry ?~ "w" table)
+    ;; Beware: `w' should not be used for non-alphabetic chars.
+    (modify-syntax-entry ?~ "_" table)
     (modify-syntax-entry ?% "." table)
-    (modify-syntax-entry ?- "w" table)
-    (modify-syntax-entry ?_ "w" table)
-    (modify-syntax-entry ?{ "w" table)
-    (modify-syntax-entry ?} "w" table)
+    (modify-syntax-entry ?- "_" table)
+    (modify-syntax-entry ?_ "_" table)
+    ;; FIXME: { and } can appear in identifiers?  Really?
+    (modify-syntax-entry ?{ "_" table)
+    (modify-syntax-entry ?} "_" table)
     (modify-syntax-entry ?\\ "." table)
     table))
 
 ;; 4  User functions
 
 (defun dos-cmd-help (cmd)
-  "Show help for Dos command."
+  "Show help for Dos command CMD."
   (interactive "sHelp: ")
   (if (string-equal cmd "net")
+      ;; FIXME: liable to quoting nightmare.  Use call-process?
       (shell-command "net /?") (shell-command (concat "help " cmd))))
 
 (defun dos-mode-help ()
@@ -149,11 +153,13 @@
 (defun dos-run ()
   "Run Dos script."
   (interactive)
+  ;; FIXME: liable to quoting nightmare.  Use call/start-process?
   (save-buffer) (shell-command buffer-file-name))
 
 (defun dos-run-args (args)
   "Run Dos script with ARGS."
   (interactive "sArgs: ")
+  ;; FIXME: Use `compile'?
   (shell-command (concat buffer-file-name " " args)))
 
 (defun dos-template ()
@@ -161,6 +167,9 @@
   (interactive)
   (goto-char (point-min)) (insert "@echo off\nsetlocal\n\n"))
 
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.\\(bat\\|cmd\\)\\'" . dos-mode))
+
 ;; 5  Main function
 
 ;;;###autoload
@@ -171,12 +180,11 @@
 `dos-cmd-help'. Navigate between sections using `imenu'. Run script using
 `dos-run' and `dos-run-args'.\n
 \\{dos-mode-map}"
-  (set (make-local-variable 'comment-start) "rem")
-  (set (make-local-variable 'font-lock-defaults)
+  (setq-local comment-start "rem ")
+  (setq-local font-lock-defaults
        '(dos-font-lock-keywords nil t)) ; case-insensitive keywords
-  (set (make-local-variable 'imenu-generic-expression) '((nil "^:[^:].*" 0)))
-  (set (make-local-variable 'outline-regexp) ":[^:]")
-  (set-syntax-table dos-mode-syntax-table))
+  (setq-local imenu-generic-expression '((nil "^:[^:].*" 0)))
+  (setq-local outline-regexp ":[^:]"))
 
 (provide 'dos)
 






^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 17:26                 ` Juanma Barranquero
@ 2013-08-07 18:11                   ` Stefan Monnier
  2013-08-07 19:18                     ` Eli Zaretskii
  2013-08-07 19:39                     ` Juanma Barranquero
  0 siblings, 2 replies; 31+ messages in thread
From: Stefan Monnier @ 2013-08-07 18:11 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Arni Magnusson, 14732

> Of course, I suppose that if I try to add support (font-locking.
> mostly) for TCC, the proprietary command interpreter part of
> TakeCommand, I will be shoot down, even if CMD itself is not exactly
> free software...

Right, support for DOS/Windows batch files is indeed borderline in
this respect.  I considered it acceptable on the basis that the GPL
accepts linking with proprietary libraries as long as they are "part of
the basic OS" and I think cmd.exe also fits this description of "the
basic OS".  So in this sense, it does not encourage installation of
non-Free software (you're unlikely to install Windows just in order to
run a batch file).
That same argument wouldn't work for TCC.


        Stefan "who happened to «run» his very first .bat file recently
                (did by hand, for lack of a .bat interpreter; that was
                to get root access on an Android device ;-)"





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 18:11                   ` Stefan Monnier
@ 2013-08-07 19:18                     ` Eli Zaretskii
  2013-08-07 19:49                       ` Juanma Barranquero
  2013-08-07 21:12                       ` Stefan Monnier
  2013-08-07 19:39                     ` Juanma Barranquero
  1 sibling, 2 replies; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-07 19:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 14732, arnima

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Wed, 07 Aug 2013 14:11:31 -0400
> Cc: Arni Magnusson <arnima@hafro.is>, 14732@debbugs.gnu.org
> 
> > Of course, I suppose that if I try to add support (font-locking.
> > mostly) for TCC, the proprietary command interpreter part of
> > TakeCommand, I will be shoot down, even if CMD itself is not exactly
> > free software...
> 
> Right, support for DOS/Windows batch files is indeed borderline in
> this respect.  I considered it acceptable on the basis that the GPL
> accepts linking with proprietary libraries as long as they are "part of
> the basic OS" and I think cmd.exe also fits this description of "the
> basic OS".

Look at that this way: you don't support cmd, you support people who
write batch files to build and run free software.

> That same argument wouldn't work for TCC.

Why does it work for csh, then?





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 18:11                   ` Stefan Monnier
  2013-08-07 19:18                     ` Eli Zaretskii
@ 2013-08-07 19:39                     ` Juanma Barranquero
  2013-08-07 21:12                       ` Stefan Monnier
  1 sibling, 1 reply; 31+ messages in thread
From: Juanma Barranquero @ 2013-08-07 19:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Arni Magnusson, 14732

On Wed, Aug 7, 2013 at 8:11 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> So in this sense, it does not encourage installation of
> non-Free software (you're unlikely to install Windows just in order to
> run a batch file).  That same argument wouldn't work for TCC.

TakeCommand is a glorified CMD. Or, nowadays, TCC is a glorified CMD,
and TakeCommand is a pretty interface that allows you to run multiple
console programs (not just TCC / CMD) in a tabbed interface. So, no
one would install Windows just to run TakeCommand.

But I won't press the point.

   J





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 19:18                     ` Eli Zaretskii
@ 2013-08-07 19:49                       ` Juanma Barranquero
  2013-08-07 21:12                       ` Stefan Monnier
  1 sibling, 0 replies; 31+ messages in thread
From: Juanma Barranquero @ 2013-08-07 19:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Arni Magnusson, 14732

On Wed, Aug 7, 2013 at 9:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> Why does it work for csh, then?

Windows programs are discriminated. nt/INSTALL has had this comment  for years:

  In addition, using 4NT or TCC as your shell is known to fail the
  build process, at least since 4NT version 3.01.

The only "problem" is in this bit of nt/configure.bat:

  rem   See if the environment is large enough.  We need 43 (?) bytes.
  set $foo$=123456789_123456789_123456789_123456789_123
  if not "%$foo$%" == "123456789_123456789_123456789_123456789_123"
goto SmallEnv
  set $foo$=

because of the "%$foo$" (in 4NT/TCC, %$ is a special variable). Just
changing that test from using $foo$ to foo$ would have allowed 4NT to
run configure.bat just fine. I proposed such a change, years ago, and
was told not to. Which is particularly jarring because, AFAICS, that
check is obsolete; modern CMD has no problem with big environments,
and even if the check still makes sense in old COMMAND.COM, we've been
adding things to configure.bat for a long time without bothering to
check the environment space required.

   J





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 19:39                     ` Juanma Barranquero
@ 2013-08-07 21:12                       ` Stefan Monnier
  2013-08-07 21:19                         ` Juanma Barranquero
  0 siblings, 1 reply; 31+ messages in thread
From: Stefan Monnier @ 2013-08-07 21:12 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Arni Magnusson, 14732

> TakeCommand is a glorified CMD. Or, nowadays, TCC is a glorified CMD,
> and TakeCommand is a pretty interface that allows you to run multiple
> console programs (not just TCC / CMD) in a tabbed interface. So, no
> one would install Windows just to run TakeCommand.

You need to replace "install Windows" with "install TakeCommand" in the
above sentence to see the problem.


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 19:18                     ` Eli Zaretskii
  2013-08-07 19:49                       ` Juanma Barranquero
@ 2013-08-07 21:12                       ` Stefan Monnier
  2013-08-08  2:45                         ` Eli Zaretskii
  1 sibling, 1 reply; 31+ messages in thread
From: Stefan Monnier @ 2013-08-07 21:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 14732, arnima

>> That same argument wouldn't work for TCC.
> Why does it work for csh, then?

AFAIK csh is Free Software.


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 21:12                       ` Stefan Monnier
@ 2013-08-07 21:19                         ` Juanma Barranquero
  0 siblings, 0 replies; 31+ messages in thread
From: Juanma Barranquero @ 2013-08-07 21:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Arni Magnusson, 14732

On Wed, Aug 7, 2013 at 11:12 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>
> You need to replace "install Windows" with "install TakeCommand" in the
> above sentence to see the problem.

No, I don't see the problem. What no one is ever going to do is switch
to GNU/Linux because Emacs does not highlight their TCC bat scripts.
People who use TakeCommand are hardcore command-line oriented Windows
users, or enterprises, and they won't switch for any petty reason, or
at all.

   J





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-07 21:12                       ` Stefan Monnier
@ 2013-08-08  2:45                         ` Eli Zaretskii
  2013-08-08  3:47                           ` Stefan Monnier
  0 siblings, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-08  2:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 14732, arnima

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lekktu@gmail.com,  arnima@hafro.is,  14732@debbugs.gnu.org
> Date: Wed, 07 Aug 2013 17:12:57 -0400
> 
> >> That same argument wouldn't work for TCC.
> > Why does it work for csh, then?
> 
> AFAIK csh is Free Software.

Nothing you find on a typical proprietary Unix these days is Free
Software.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-06-27 16:15 bug#14732: Package dos-mode for ELPA Arni Magnusson
  2013-06-27 17:40 ` Eli Zaretskii
  2013-07-01  1:00 ` Arni Magnusson
@ 2013-08-08  3:40 ` Glenn Morris
  2013-08-08 16:59   ` Eli Zaretskii
  2 siblings, 1 reply; 31+ messages in thread
From: Glenn Morris @ 2013-08-08  3:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 14732, arnima

Eli Zaretskii wrote:

>> AFAIK csh is Free Software.
>
> Nothing you find on a typical proprietary Unix these days is Free
> Software.

I for one am totally confused as to what point you are trying to make.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08  2:45                         ` Eli Zaretskii
@ 2013-08-08  3:47                           ` Stefan Monnier
  2013-08-08 17:05                             ` Eli Zaretskii
  0 siblings, 1 reply; 31+ messages in thread
From: Stefan Monnier @ 2013-08-08  3:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 14732, arnima

>> >> That same argument wouldn't work for TCC.
>> > Why does it work for csh, then?
>> AFAIK csh is Free Software.
> Nothing you find on a typical proprietary Unix these days is Free
> Software.

Last time I checked, csh comes with a BSD license.
If it's not Free Software, Trisquel and Debian would probably be
interested to learn about it.


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08  3:40 ` Glenn Morris
@ 2013-08-08 16:59   ` Eli Zaretskii
  0 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-08 16:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: lekktu, 14732, arnima

> From: Glenn Morris <rgm@gnu.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  lekktu@gmail.com,  14732@debbugs.gnu.org,  arnima@hafro.is
> Date: Wed, 07 Aug 2013 23:40:38 -0400
> 
> Eli Zaretskii wrote:
> 
> >> AFAIK csh is Free Software.
> >
> > Nothing you find on a typical proprietary Unix these days is Free
> > Software.
> 
> I for one am totally confused as to what point you are trying to make.

The point is that we should discourage non-free software regardless of
whether it comes from Microsoft, SCO, AT&T, or you-name-it.
Currently, we are biased in that respect.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08  3:47                           ` Stefan Monnier
@ 2013-08-08 17:05                             ` Eli Zaretskii
  2013-08-08 17:28                               ` Glenn Morris
  2013-08-08 17:48                               ` Stefan Monnier
  0 siblings, 2 replies; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-08 17:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 14732, arnima

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lekktu@gmail.com,  arnima@hafro.is,  14732@debbugs.gnu.org
> Date: Wed, 07 Aug 2013 23:47:19 -0400
> 
> >> >> That same argument wouldn't work for TCC.
> >> > Why does it work for csh, then?
> >> AFAIK csh is Free Software.
> > Nothing you find on a typical proprietary Unix these days is Free
> > Software.
> 
> Last time I checked, csh comes with a BSD license.

I guess I confused it with ksh, sorry.

And ksh is not the worst offender: look in sh-script, and you will see
there, in addition to ksh, also rc from Plan 9 and even (gasp!) SCO's
oash.

If we care so much about not supporting non-free shells, why do we
have all those in sh-script?





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08 17:05                             ` Eli Zaretskii
@ 2013-08-08 17:28                               ` Glenn Morris
  2013-08-08 17:52                                 ` Eli Zaretskii
  2013-08-08 17:48                               ` Stefan Monnier
  1 sibling, 1 reply; 31+ messages in thread
From: Glenn Morris @ 2013-08-08 17:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 14732, arnima

Eli Zaretskii wrote:

>> Last time I checked, csh comes with a BSD license.
>
> I guess I confused it with ksh, sorry.

Which is also available as free software (CPL), and is packaged by
Debian, Red Hat, etc.

> And ksh is not the worst offender: look in sh-script, and you will see
> there, in addition to ksh, also rc from Plan 9 and even (gasp!) SCO's
> oash.
>
> If we care so much about not supporting non-free shells, why do we
> have all those in sh-script?

Accidents of ancient history, I guess.

> The point is that we should discourage non-free software regardless of
> whether it comes from Microsoft, SCO, AT&T, or you-name-it.

Sure.

> Currently, we are biased in that respect.

I disagree.





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08 17:05                             ` Eli Zaretskii
  2013-08-08 17:28                               ` Glenn Morris
@ 2013-08-08 17:48                               ` Stefan Monnier
  1 sibling, 0 replies; 31+ messages in thread
From: Stefan Monnier @ 2013-08-08 17:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 14732, arnima

>> >> >> That same argument wouldn't work for TCC.
>> >> > Why does it work for csh, then?
>> >> AFAIK csh is Free Software.
>> > Nothing you find on a typical proprietary Unix these days is Free
>> > Software.
>> Last time I checked, csh comes with a BSD license.
> I guess I confused it with ksh, sorry.
> And ksh is not the worst offender: look in sh-script, and you will see
> there, in addition to ksh, also rc from Plan 9 and even (gasp!) SCO's
> oash.

"rc" is in Debian's "main" section, so I assume it's also Free Software.
As for oash, yes, that makes no sense (how many people use that crap anyway?).
Feel free to remove it.

For ksh, there might be support in there for versions of ksh that still
aren't Free Software, but the I doubt there's much of sh-script.el's ksh
support which can't be used with a Free ksh.

> If we care so much about not supporting non-free shells, why do we
> have all those in sh-script?

Historical accident.

> The point is that we should discourage non-free software regardless of
> whether it comes from Microsoft, SCO, AT&T, or you-name-it.

Agreed.  Although, there is a bit more to it than that: e.g. we rejected
support for C# because the Mono version was so poor that it was clearly
mostly supporting the proprietary version.
I haven't followed Mono's development very closely, but I'd welcome C#
support in Emacs.

> Currently, we are biased in that respect.

I try not to.


        Stefan





^ permalink raw reply	[flat|nested] 31+ messages in thread

* bug#14732: Package dos-mode for ELPA
  2013-08-08 17:28                               ` Glenn Morris
@ 2013-08-08 17:52                                 ` Eli Zaretskii
  0 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2013-08-08 17:52 UTC (permalink / raw)
  To: Glenn Morris; +Cc: lekktu, 14732, arnima

> From: Glenn Morris <rgm@gnu.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  lekktu@gmail.com,  14732@debbugs.gnu.org,  arnima@hafro.is
> Date: Thu, 08 Aug 2013 13:28:23 -0400
> 
> Eli Zaretskii wrote:
> 
> >> Last time I checked, csh comes with a BSD license.
> >
> > I guess I confused it with ksh, sorry.
> 
> Which is also available as free software (CPL), and is packaged by
> Debian, Red Hat, etc.

But we don't check the license when we detect ksh.  We support them
all, free and non-free.

> > The point is that we should discourage non-free software regardless of
> > whether it comes from Microsoft, SCO, AT&T, or you-name-it.
> 
> Sure.
> 
> > Currently, we are biased in that respect.
> 
> I disagree.

I will agree with you when I will see all of the above removed from
sh-script.





^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2013-08-08 17:52 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27 16:15 bug#14732: Package dos-mode for ELPA Arni Magnusson
2013-06-27 17:40 ` Eli Zaretskii
2013-07-01  1:00 ` Arni Magnusson
2013-07-01 10:44   ` Arni Magnusson
2013-07-01 16:50   ` Eli Zaretskii
2013-07-01 23:30     ` Stefan Monnier
2013-07-02  0:12       ` Arni Magnusson
2013-08-05  0:16         ` Stefan Monnier
2013-08-05  2:20           ` Arni Magnusson
2013-08-06 21:00             ` Stefan Monnier
2013-08-07 15:54               ` Stefan Monnier
2013-08-07 16:14                 ` Eli Zaretskii
2013-08-07 17:27                   ` Stefan Monnier
2013-08-07 17:26                 ` Juanma Barranquero
2013-08-07 18:11                   ` Stefan Monnier
2013-08-07 19:18                     ` Eli Zaretskii
2013-08-07 19:49                       ` Juanma Barranquero
2013-08-07 21:12                       ` Stefan Monnier
2013-08-08  2:45                         ` Eli Zaretskii
2013-08-08  3:47                           ` Stefan Monnier
2013-08-08 17:05                             ` Eli Zaretskii
2013-08-08 17:28                               ` Glenn Morris
2013-08-08 17:52                                 ` Eli Zaretskii
2013-08-08 17:48                               ` Stefan Monnier
2013-08-07 19:39                     ` Juanma Barranquero
2013-08-07 21:12                       ` Stefan Monnier
2013-08-07 21:19                         ` Juanma Barranquero
2013-07-07 12:34       ` Arni Magnusson
2013-07-10  0:43         ` Arni Magnusson
2013-08-08  3:40 ` Glenn Morris
2013-08-08 16:59   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).