unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.
       [not found] <E1UnUBD-0001cG-LM@vcs.savannah.gnu.org>
@ 2013-06-14 15:51 ` Stefan Monnier
  2013-06-14 18:55   ` Tassilo Horn
  2013-06-14 21:44   ` add-file-local-variable (was: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.) Juri Linkov
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-06-14 15:51 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-devel

> +;; -*- coding: iso-2022-jp-unix; -*-
> +
>  ;;; tex-jp.el --- Support for Japanese TeX.

Elisp files should start with ";;; <name> --- <desc>", so please use

>  ;;; tex-jp.el --- Support for Japanese TeX.  -*- coding: iso-2022-jp-unix; -*-

instead, even though it spills over the sacred 80-columns limit.


        Stefan



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

* Re: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.
  2013-06-14 15:51 ` [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie Stefan Monnier
@ 2013-06-14 18:55   ` Tassilo Horn
  2013-06-14 21:44   ` add-file-local-variable (was: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.) Juri Linkov
  1 sibling, 0 replies; 4+ messages in thread
From: Tassilo Horn @ 2013-06-14 18:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> +;; -*- coding: iso-2022-jp-unix; -*-
>> +
>>  ;;; tex-jp.el --- Support for Japanese TeX.
>
> Elisp files should start with ";;; <name> --- <desc>", so please use
>
>>  ;;; tex-jp.el --- Support for Japanese TeX.  -*- coding: iso-2022-jp-unix; -*-
>
> instead, even though it spills over the sacred 80-columns limit.

Ok, done.

Bye,
Tassilo



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

* add-file-local-variable (was: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.)
  2013-06-14 15:51 ` [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie Stefan Monnier
  2013-06-14 18:55   ` Tassilo Horn
@ 2013-06-14 21:44   ` Juri Linkov
  2013-06-15  1:45     ` add-file-local-variable Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2013-06-14 21:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>> +;; -*- coding: iso-2022-jp-unix; -*-
>> +
>>  ;;; tex-jp.el --- Support for Japanese TeX.
>
> Elisp files should start with ";;; <name> --- <desc>", so please use
>
>>  ;;; tex-jp.el --- Support for Japanese TeX.  -*- coding: iso-2022-jp-unix; -*-
>
> instead, even though it spills over the sacred 80-columns limit.

`add-file-local-variable-prop-line' currently inserts local variables
such as `coding' and `lexical-binding' before the header line,
thus breaking this convention.

If the following is a sufficiently general approach, it should add
local variables to the end of the comment on the first line in any mode:

=== modified file 'lisp/files-x.el'
--- lisp/files-x.el	2013-01-01 09:11:05 +0000
+++ lisp/files-x.el	2013-06-14 21:38:37 +0000
@@ -261,14 +264,34 @@ (defun modify-file-local-variable-prop-l
 	  (forward-line 1))
 
 	(let ((comment-style 'plain)
-	      (comment-start (or comment-start ";;; ")))
+	      (comment-start (or comment-start ";;; "))
+	      (line-beg (line-beginning-position))
+	      (ce nil))
+	  (comment-normalize-vars)
+	  ;; If the first line contains a comment.
+	  (if (save-excursion
+		(and (looking-at comment-start-skip)
+		     (goto-char (match-end 0))
+		     (re-search-forward comment-end-skip)
+		     (goto-char (match-beginning 0))
+		     ;; Still on the same line?
+		     (equal line-beg (line-beginning-position))
+		     (setq ce (point))))
+	      ;; Add local variables to the end of the existing comment.
+	      (progn
+		(goto-char ce)
+		(insert "  -*-")
+		(setq beg (point-marker))
+		(setq end (point-marker))
+		(insert "-*-"))
+	    ;; Otherwise, create a new comment before the first line.
 	  (comment-region
 	   (prog1 (point)
 	     (insert "-*-")
 	     (setq beg (point-marker))
 	     (setq end (point-marker))
 	     (insert "-*-\n"))
-	   (point))))
+	     (point)))))
 
       (cond
        ((looking-at "[ \t]*\\([^ \t\n\r:;]+\\)\\([ \t]*-\\*-\\)")




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

* Re: add-file-local-variable
  2013-06-14 21:44   ` add-file-local-variable (was: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.) Juri Linkov
@ 2013-06-15  1:45     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-06-15  1:45 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

> `add-file-local-variable-prop-line' currently inserts local variables
> such as `coding' and `lexical-binding' before the header line,
> thus breaking this convention.

Indeed, that needs fixing.

> If the following is a sufficiently general approach, it should add
> local variables to the end of the comment on the first line in any mode:

It's not always perfect, but it's better than what we currently have,
thank you.


        Stefan



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

end of thread, other threads:[~2013-06-15  1:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1UnUBD-0001cG-LM@vcs.savannah.gnu.org>
2013-06-14 15:51 ` [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie Stefan Monnier
2013-06-14 18:55   ` Tassilo Horn
2013-06-14 21:44   ` add-file-local-variable (was: [ELPA-diffs] elpa r408: * packages/auctex/tex-jp.el: Add coding cookie.) Juri Linkov
2013-06-15  1:45     ` add-file-local-variable Stefan Monnier

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).