unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
@ 2007-05-17  9:58 Richard Stallman
  2007-05-17 11:29 ` Christian Plate
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2007-05-17  9:58 UTC (permalink / raw)
  To: emacs-devel

This doesn't need to be fixed for Emacs 22, but it would be good for
someone to fix it in the trunk.

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
Date: Wed, 16 May 2007 15:50:14 +0200
From: Francesco Potorti` <pot@gnu.org>
To: emacs-pretest-bug@gnu.org
Organization: 
Subject: (setq sgml-transformation 'upcase) has no effect

>From textmodes/sgml-mode.el:

================
If you like upcased tags, put (setq sgml-transformation-function 'upcase)
in your `.emacs' file.
================

To reproduce the problem:

emacs -Q
C-x C-f a.html RET
M-x set-variable RET sgml-transformation-function RET upcase RET
C-c C-t small RET

what appears in the buffer is 

  <small></small>

rather than the expected

  <SMALL></SMALL>

As far as I remember, this is an old bug.


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17  9:58 [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect] Richard Stallman
@ 2007-05-17 11:29 ` Christian Plate
  2007-05-17 13:34   ` Thien-Thi Nguyen
  2007-05-17 14:14   ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Christian Plate @ 2007-05-17 11:29 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Hi,

On Thursday 17 May 2007 11:58, Richard Stallman wrote:
> This doesn't need to be fixed for Emacs 22, but it would be good for
> someone to fix it in the trunk.

this is my first patch for Emacs and I'm not that familiar with lisp, but the 
fix seems to be trivial.

Regards,
  Christian

*** sgml-mode.el	17 Mai 2007 13:05:53 +0200	1.123
--- sgml-mode.el	17 Mai 2007 13:06:57 +0200	
***************
*** 620,629 ****
    "Prompt for a tag and insert it, optionally with attributes.
  Completion and configuration are done according to `sgml-tag-alist'.
  If you like tags and attributes in uppercase do \\[set-variable]
! `skeleton-transformation-function' RET `upcase' RET, or put this
  in your `.emacs':
    (setq sgml-transformation-function 'upcase)"
!   (funcall (or skeleton-transformation-function 'identity)
             (setq sgml-tag-last
  		 (completing-read
  		  (if (> (length sgml-tag-last) 0)
--- 620,629 ----
    "Prompt for a tag and insert it, optionally with attributes.
  Completion and configuration are done according to `sgml-tag-alist'.
  If you like tags and attributes in uppercase do \\[set-variable]
! `sgml-transformation-function' RET `upcase' RET, or put this
  in your `.emacs':
    (setq sgml-transformation-function 'upcase)"
!   (funcall (or sgml-transformation-function 'identity)
             (setq sgml-tag-last
  		 (completing-read
  		  (if (> (length sgml-tag-last) 0)

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 11:29 ` Christian Plate
@ 2007-05-17 13:34   ` Thien-Thi Nguyen
  2007-05-17 23:14     ` Stefan Monnier
  2007-05-17 14:14   ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Thien-Thi Nguyen @ 2007-05-17 13:34 UTC (permalink / raw)
  To: Christian Plate; +Cc: rms, emacs-devel

() Christian Plate <cplate@web.de>
() Thu, 17 May 2007 13:29:36 +0200

   this is my first patch for Emacs and I'm not that familiar with lisp,
   but the fix seems to be trivial.  [patch]

installed; thanks.

thi

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 11:29 ` Christian Plate
  2007-05-17 13:34   ` Thien-Thi Nguyen
@ 2007-05-17 14:14   ` Stefan Monnier
  2007-05-17 15:28     ` Christian Plate
  2007-05-17 17:00     ` Christian Plate
  1 sibling, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-05-17 14:14 UTC (permalink / raw)
  To: Christian Plate; +Cc: rms, emacs-devel

> this is my first patch for Emacs and I'm not that familiar with lisp, but
> the  fix seems to be trivial.

That will only fix some cases, but not all.


        Stefan

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 14:14   ` Stefan Monnier
@ 2007-05-17 15:28     ` Christian Plate
  2007-05-17 17:00     ` Christian Plate
  1 sibling, 0 replies; 9+ messages in thread
From: Christian Plate @ 2007-05-17 15:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: rms, emacs-devel

On Thursday 17 May 2007 16:14, Stefan Monnier wrote:
> That will only fix some cases, but not all.

You are right. I'll try to fix the other cases, too.

Regards, Christian

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 14:14   ` Stefan Monnier
  2007-05-17 15:28     ` Christian Plate
@ 2007-05-17 17:00     ` Christian Plate
  2007-05-17 23:16       ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Christian Plate @ 2007-05-17 17:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

On Thursday 17 May 2007 16:14, Stefan Monnier wrote:
> That will only fix some cases, but not all.

I have attached the fix for all cases.

Regards,  Christian


[-- Attachment #2: sgml-mode.el.diff --]
[-- Type: text/x-diff, Size: 9899 bytes --]

Index: sgml-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/sgml-mode.el,v
retrieving revision 1.124
diff -c -r1.124 sgml-mode.el
*** sgml-mode.el	17 May 2007 13:31:51 -0000	1.124
--- sgml-mode.el	17 May 2007 16:56:21 -0000
***************
*** 676,687 ****
  	(if (stringp (car alist))
  	    (progn
  	      (insert (if (eq (preceding-char) ?\s) "" ?\s)
! 		      (funcall skeleton-transformation-function (car alist)))
  	      (sgml-value alist))
  	  (setq i (length alist))
  	  (while (> i 0)
  	    (insert ?\s)
! 	    (insert (funcall skeleton-transformation-function
  			     (setq attribute
  				   (skeleton-read '(completing-read
  						    "Attribute: "
--- 676,687 ----
  	(if (stringp (car alist))
  	    (progn
  	      (insert (if (eq (preceding-char) ?\s) "" ?\s)
! 		      (funcall sgml-transformation-function (car alist)))
  	      (sgml-value alist))
  	  (setq i (length alist))
  	  (while (> i 0)
  	    (insert ?\s)
! 	    (insert (funcall sgml-transformation-function
  			     (setq attribute
  				   (skeleton-read '(completing-read
  						    "Attribute: "
***************
*** 1921,2026 ****
  (define-skeleton html-href-anchor
    "HTML anchor tag with href attribute."
    "URL: "
!   ;; '(setq input "http:")
!   "<a href=\"" str "\">" _ "</a>")
  
  (define-skeleton html-name-anchor
    "HTML anchor tag with name attribute."
    "Name: "
!   "<a name=\"" str "\""
!   (if sgml-xml-mode (concat " id=\"" str "\""))
!   ">" _ "</a>")
  
  (define-skeleton html-headline-1
    "HTML level 1 headline tags."
    nil
!   "<h1>" _ "</h1>")
  
  (define-skeleton html-headline-2
    "HTML level 2 headline tags."
    nil
!   "<h2>" _ "</h2>")
  
  (define-skeleton html-headline-3
    "HTML level 3 headline tags."
    nil
!   "<h3>" _ "</h3>")
  
  (define-skeleton html-headline-4
    "HTML level 4 headline tags."
    nil
!   "<h4>" _ "</h4>")
  
  (define-skeleton html-headline-5
    "HTML level 5 headline tags."
    nil
!   "<h5>" _ "</h5>")
  
  (define-skeleton html-headline-6
    "HTML level 6 headline tags."
    nil
!   "<h6>" _ "</h6>")
  
  (define-skeleton html-horizontal-rule
    "HTML horizontal rule tag."
    nil
!   (if sgml-xml-mode "<hr />" "<hr>") \n)
  
  (define-skeleton html-image
    "HTML image tag."
    "Image URL: "
!   "<img src=\"" str "\" alt=\"" _ "\""
    (if sgml-xml-mode " />" ">"))
  
  (define-skeleton html-line
    "HTML line break tag."
    nil
!   (if sgml-xml-mode "<br />" "<br>") \n)
  
  (define-skeleton html-ordered-list
    "HTML ordered list tags."
    nil
!   "<ol>" \n
!   "<li>" _ (if sgml-xml-mode "</li>") \n
!   "</ol>")
  
  (define-skeleton html-unordered-list
    "HTML unordered list tags."
    nil
!   "<ul>" \n
!   "<li>" _ (if sgml-xml-mode "</li>") \n
!   "</ul>")
  
  (define-skeleton html-list-item
    "HTML list item tag."
    nil
    (if (bolp) nil '\n)
!   "<li>" _ (if sgml-xml-mode "</li>"))
  
  (define-skeleton html-paragraph
    "HTML paragraph tag."
    nil
    (if (bolp) nil ?\n)
!   "<p>" _ (if sgml-xml-mode "</p>"))
! 
  (define-skeleton html-checkboxes
    "Group of connected checkbox inputs."
    nil
    '(setq v1 nil
  	 v2 nil)
    ("Value: "
!    "<input type=\"" (identity "checkbox") ; see comment above about identity
!    "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
!    "\" value=\"" str ?\"
     (when (y-or-n-p "Set \"checked\" attribute? ")
!      (funcall skeleton-transformation-function
! 	      (if sgml-xml-mode " checked=\"checked\"" " checked")))
     (if sgml-xml-mode " />" ">")
     (skeleton-read "Text: " (capitalize str))
     (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
! 		       (funcall skeleton-transformation-function
!                                 (if sgml-xml-mode "<br />" "<br>"))
! 		     "")))
     \n))
  
  (define-skeleton html-radio-buttons
--- 1921,2058 ----
  (define-skeleton html-href-anchor
    "HTML anchor tag with href attribute."
    "URL: "
!   (funcall sgml-transformation-function "<a href=\"") 
!   str "\">" _ (funcall sgml-transformation-function "</a>"))
  
  (define-skeleton html-name-anchor
    "HTML anchor tag with name attribute."
    "Name: "
!   (funcall sgml-transformation-function "<a name=\"") 
!   str "\""
!   (if sgml-xml-mode (concat (funcall sgml-transformation-function " id=\"") 
! 			    str "\""))
!   ">" _ (funcall sgml-transformation-function "</a>"))
  
  (define-skeleton html-headline-1
    "HTML level 1 headline tags."
    nil
!   (funcall sgml-transformation-function "<h1>") 
!   _ 
!   (funcall sgml-transformation-function "</h1>"))
  
  (define-skeleton html-headline-2
    "HTML level 2 headline tags."
    nil
!   (funcall sgml-transformation-function "<h2>")
!   _ 
!   (funcall sgml-transformation-function "</h2>"))
  
  (define-skeleton html-headline-3
    "HTML level 3 headline tags."
    nil
!   (funcall sgml-transformation-function "<h3>")
!   _ 
!   (funcall sgml-transformation-function "</h3>"))
  
  (define-skeleton html-headline-4
    "HTML level 4 headline tags."
    nil
!   (funcall sgml-transformation-function "<h4>")
!   _ 
!   (funcall sgml-transformation-function "</h4>"))
  
  (define-skeleton html-headline-5
    "HTML level 5 headline tags."
    nil
!   (funcall sgml-transformation-function "<h5>")
!   _ 
!   (funcall sgml-transformation-function "</h5>"))
  
  (define-skeleton html-headline-6
    "HTML level 6 headline tags."
    nil
!   (funcall sgml-transformation-function "<h6>")
!   _ 
!   (funcall sgml-transformation-function "</h6>"))
  
  (define-skeleton html-horizontal-rule
    "HTML horizontal rule tag."
    nil
!   (if sgml-xml-mode 
!       (funcall sgml-transformation-function "<hr />")
!     (funcall sgml-transformation-function "<hr>")) \n)
  
  (define-skeleton html-image
    "HTML image tag."
    "Image URL: "
!   (funcall sgml-transformation-function "<img src=\"")
!   str (funcall sgml-transformation-function "\" alt=\"")
!   _ "\""
    (if sgml-xml-mode " />" ">"))
  
  (define-skeleton html-line
    "HTML line break tag."
    nil
!   (if sgml-xml-mode 
!       (funcall sgml-transformation-function "<br />")
!     (funcall sgml-transformation-function "<br>")) \n)
  
  (define-skeleton html-ordered-list
    "HTML ordered list tags."
    nil
!   (funcall sgml-transformation-function "<ol>") \n
!   (funcall sgml-transformation-function "<li>")
!   _ 
!   (if sgml-xml-mode (funcall sgml-transformation-function "</li>")) \n
!   (funcall sgml-transformation-function "</ol>"))
  
  (define-skeleton html-unordered-list
    "HTML unordered list tags."
    nil
!   (funcall sgml-transformation-function "<ul>") \n
!   (funcall sgml-transformation-function "<li>")
!   _ 
!   (if sgml-xml-mode (funcall sgml-transformation-function "</li>")) \n
!   (funcall sgml-transformation-function "</ul>"))
  
  (define-skeleton html-list-item
    "HTML list item tag."
    nil
    (if (bolp) nil '\n)
!   (funcall sgml-transformation-function "<li>")
!   _ 
!   (if sgml-xml-mode (funcall sgml-transformation-function "</li>")))
  
  (define-skeleton html-paragraph
    "HTML paragraph tag."
    nil
    (if (bolp) nil ?\n)
!   (funcall sgml-transformation-function "<p>") 
!   _ 
!   (if sgml-xml-mode (funcall sgml-transformation-function "</p>")))
!   
  (define-skeleton html-checkboxes
    "Group of connected checkbox inputs."
    nil
    '(setq v1 nil
  	 v2 nil)
    ("Value: "
!    (funcall sgml-transformation-function "<input type=\"")
!    (identity "checkbox") ; see comment above about identity
!    (funcall sgml-transformation-function "\" name=\"")
!    (or v1 (setq v1 (skeleton-read "Name: ")))
!    (funcall sgml-transformation-function "\" value=\"")
!    str ?\"
     (when (y-or-n-p "Set \"checked\" attribute? ")
!      (if sgml-xml-mode 
! 	 (funcall sgml-transformation-function " checked=\"checked\"")
!        (funcall sgml-transformation-function " checked")))
     (if sgml-xml-mode " />" ">")
     (skeleton-read "Text: " (capitalize str))
     (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
! 		       (funcall sgml-transformation-function 
! 				(if sgml-xml-mode "<br />" "<br>"))
! 		     ""))) 
     \n))
  
  (define-skeleton html-radio-buttons
***************
*** 2029,2044 ****
    '(setq v1 nil
  	 v2 (cons nil nil))
    ("Value: "
!    "<input type=\"" (identity "radio") ; see comment above about identity
!    "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
!    "\" value=\"" str ?\"
     (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
!      (funcall skeleton-transformation-function
! 	      (if sgml-xml-mode " checked=\"checked\"" " checked")))
     (if sgml-xml-mode " />" ">")
     (skeleton-read "Text: " (capitalize str))
     (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
! 			       (funcall skeleton-transformation-function
                                          (if sgml-xml-mode "<br />" "<br>"))
  			     "")))
     \n))
--- 2061,2081 ----
    '(setq v1 nil
  	 v2 (cons nil nil))
    ("Value: "
!    (funcall sgml-transformation-function "<input type=\"")
!    (identity "radio") ; see comment above about identity
!    (funcall sgml-transformation-function "\" name=\"")
!    (or (car v2) (setcar v2 (skeleton-read "Name: ")))
!    (funcall sgml-transformation-function "\" value=\"")
!    str ?\"
     (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
!      (funcall sgml-transformation-function
! 	      (if sgml-xml-mode 
! 		  " checked=\"checked\""
! 		" checked")))
     (if sgml-xml-mode " />" ">")
     (skeleton-read "Text: " (capitalize str))
     (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
! 			       (funcall sgml-transformation-function
                                          (if sgml-xml-mode "<br />" "<br>"))
  			     "")))
     \n))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 13:34   ` Thien-Thi Nguyen
@ 2007-05-17 23:14     ` Stefan Monnier
  2007-05-18  9:36       ` Thien-Thi Nguyen
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-05-17 23:14 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: Christian Plate, rms, emacs-devel

>    this is my first patch for Emacs and I'm not that familiar with lisp,
>    but the fix seems to be trivial.  [patch]

> installed; thanks.

Please remove it: it's wrong.


        Stefan

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 17:00     ` Christian Plate
@ 2007-05-17 23:16       ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-05-17 23:16 UTC (permalink / raw)
  To: Christian Plate; +Cc: rms, emacs-devel

>> That will only fix some cases, but not all.

> I have attached the fix for all cases.

I doubt that'll do them all: it ignores all the other calls to
skeleton-transformation-function that are in skeleton.el.

I.e. your approach is flawed.  If you want to do it right, you just need to
set skeleton-transformation-function not to the value of
sgml-transformation-function but to (lambda (&rest args) (apply
sgml-transformation-function args)).

I'm very much unconvinced that what this addresses is a "bug", tho.
It makes the code more complex with very little benefit, if any.


        Stefan

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

* Re: [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect]
  2007-05-17 23:14     ` Stefan Monnier
@ 2007-05-18  9:36       ` Thien-Thi Nguyen
  0 siblings, 0 replies; 9+ messages in thread
From: Thien-Thi Nguyen @ 2007-05-18  9:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Christian Plate, rms, emacs-devel

() Stefan Monnier <monnier@iro.umontreal.ca>
() Thu, 17 May 2007 19:14:09 -0400

   Please remove it: it's wrong.

done.

thi

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

end of thread, other threads:[~2007-05-18  9:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-17  9:58 [pot@gnu.org: (setq sgml-transformation 'upcase) has no effect] Richard Stallman
2007-05-17 11:29 ` Christian Plate
2007-05-17 13:34   ` Thien-Thi Nguyen
2007-05-17 23:14     ` Stefan Monnier
2007-05-18  9:36       ` Thien-Thi Nguyen
2007-05-17 14:14   ` Stefan Monnier
2007-05-17 15:28     ` Christian Plate
2007-05-17 17:00     ` Christian Plate
2007-05-17 23:16       ` 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).