unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Brockman <daniel@brockman.se>
Subject: Re: `format-spec' fails to pass on text properties
Date: Fri, 13 May 2005 18:05:52 +0200	[thread overview]
Message-ID: <87oebf5cwv.fsf@wigwam.deepwood.net> (raw)
In-Reply-To: 877ji36t69.fsf@wigwam.deepwood.net

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

Here's a fix that seems to work, but I'm not very experienced in
hacking Elisp so I'm probably doing something stupid.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1302 bytes --]

*** emacs/lisp/gnus/format-spec.el~	2003-09-01 17:45:23.000000000 +0200
--- emacs/lisp/gnus/format-spec.el	2005-05-13 17:48:07.438183352 +0200
***************
*** 45,54 ****
  	(let* ((num (match-string 1))
  	       (spec (string-to-char (match-string 2)))
  	       (val (cdr (assq spec specification))))
- 	  (delete-region (1- (match-beginning 0)) (match-end 0))
  	  (unless val
  	    (error "Invalid format character: %s" spec))
! 	  (insert (format (concat "%" num "s") val))))
         ;; Signal an error on bogus format strings.
         (t
  	(error "Invalid format string"))))
--- 45,59 ----
  	(let* ((num (match-string 1))
  	       (spec (string-to-char (match-string 2)))
  	       (val (cdr (assq spec specification))))
  	  (unless val
  	    (error "Invalid format character: %s" spec))
!           (let ((text (format (concat "%" num "s") val)))
!             (insert-and-inherit text)
!             ;; Delete the specifier body.
!             (delete-region (+ (match-beginning 0) (length text))
!                            (+ (match-end 0) (length text)))
!             ;; Delete the percent sign.
!             (delete-region (1- (match-beginning 0)) (match-beginning 0)))))
         ;; Signal an error on bogus format strings.
         (t
  	(error "Invalid format string"))))

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


-- 
Daniel Brockman <daniel@brockman.se>

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

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

  reply	other threads:[~2005-05-13 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 15:29 `format-spec' fails to pass on text properties Daniel Brockman
2005-05-13 16:05 ` Daniel Brockman [this message]
2005-05-14 15:12   ` Richard Stallman
2005-05-13 16:26 ` Daniel Brockman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oebf5cwv.fsf@wigwam.deepwood.net \
    --to=daniel@brockman.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).