Gnus development mailing list
 help / color / mirror / Atom feed
From: Dave Love <d.love@dl.ac.uk>
Cc: ding@gnus.org
Subject: Re: recent smiley.el changes
Date: 11 Feb 2002 18:43:19 +0000	[thread overview]
Message-ID: <rzqit93eu60.fsf@djlvig.dl.ac.uk> (raw)
In-Reply-To: <sdk7tzwbl1.fsf@wanderer.hardakers.net>

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

Wes Hardaker <wes@hardakers.net> writes:

> So, recent changes to the gnus cvs directory replaced the smiley.el
> file I originally wrote (and billions of people hacked afterwords)
> with a new one that is a "re-written, simplified version" of the
> original.

That sounds like commentary from my smiley-ems.el (for Emacs 21).

> All fine and dandy except that the simplification means
> loss of functionality (the ability to toggle the smileys via a menu,
> pop-up help text, etc).

I provided toggling and help-echo support.

> (I won't get into why someone thought a rewrite was easier than
> sending me a form and asking "hey, we finally need this filled out to
> get it distributed with the main emacs base".

The commentary mentions assignment problems about which I sent mail,
though I don't remember the response(s).  At least, as above, it was
hacked on by others and the image provenance was unclear.  Apart from
assignment issues, the code in smiley.el basically wasn't useful for
Emacs.  Writing smiley-ems as a simple demo/test for Emacs 21 was
clearly more efficient than doing essentially the same amount of
programming plus chasing paperwork.

Note in this connexion that writing common image code is messy since
XEmacs maintainers didn't cooperate on a common API and the XEmacs API
is poorly documented.  Also the change recording in XEmacs and Gnus
has often made it difficult or impossible to figure out the copyright
status of code.  [I hope code isn't still being installed in Gnus
without assignments.]

Ob-useful ☺:


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

2002-01-11  Dave Love  <fx@gnu.org>

	* smiley-ems.el (smiley-regexp-alist): Add Unicode strings.
	(smiley-update-cache): Allow strings as well as images.
	(smiley-region, gnus-smiley-display): Doc fix.
	(smiley-region): Update to allow string display.

Index: smiley-ems.el
===================================================================
RCS file: /cvs/emacs/lisp/gnus/smiley-ems.el,v
retrieving revision 1.9
diff -u -p -r1.9 smiley-ems.el
--- smiley-ems.el	13 Dec 2000 02:07:43 -0000	1.9
+++ smiley-ems.el	11 Jan 2002 18:05:25 -0000
@@ -1,6 +1,6 @@
-;;; smiley-ems.el --- displaying smiley faces
+;;; smiley-ems.el --- displaying smiley faces -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 2000 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: news mail multimedia
@@ -51,17 +51,28 @@ This is in addition to the normal image 
 
 ;; The XEmacs version has a baroque, if not rococo, set of these.
 (defcustom smiley-regexp-alist
-  ;; Perhaps :-) should be distinct -- it does appear in the Jargon File.
-  '(("\\([:;]-?)\\)\\(\\W\\|\\'\\)" 1 "smile.pbm")
-    ("\\(:-[/\\]\\)\\(\\W\\|\\'\\)" 1 "wry.pbm")
-    ("\\(:-[({]\\)\\(\\W\\|\\'\\)" 1 "frown.pbm"))
+;; Perhaps :-) should be distinct -- it does appear in the Jargon File.
+  (if (latin1-char-displayable-p ?\^[$,2#:^[(B)
+      '(("\\([:;]-?)\\)\\(\\W\\|\\'\\)" 1 ((margin nil) "^[$,2#:^[(B"))
+	("\\(:-[/\\]\\)\\(\\W\\|\\'\\)" 1 ((margin nil) "^[$,2#;^[(B"))
+	("\\(:-[({]\\)\\(\\W\\|\\'\\)" 1 ((margin nil) "^[$,2#9^[(B")))
+    '(("\\([:;]-?)\\)\\(\\W\\|\\'\\)" 1 "smile.pbm")
+      ("\\(:-[/\\]\\)\\(\\W\\|\\'\\)" 1 "wry.pbm")
+      ("\\(:-[({]\\)\\(\\W\\|\\'\\)" 1 "frown.pbm")))
   "*A list of regexps to map smilies to images.
 The elements are (REGEXP MATCH FILE), where MATCH is the submatch in
 rgexp to replace with IMAGE.  IMAGE is the name of a PBM file in
 `smiley-data-directory' or the normal image search path."
   :type '(repeat (list regexp
 		       (integer :tag "Regexp match number")
-		       (string :tag "Image name")))
+		       (choice (string :tag "Image name")
+			       (const :tag "Smiling face character"
+				      ((margin nil) "^[$,2#:^[(B"))
+			       (const :tag "Frowning face character"
+				      ((margin nil) "^[$,2#9^[(B"))
+			       (const :tag "Black smiling face character"
+				      ((margin nil) "^[$,2#;^[(B"))
+			       (sexp :tag "General display property"))))
   :set (lambda (symbol value)
 	 (set-default symbol value)
 	 (smiley-update-cache))
@@ -73,11 +84,13 @@ rgexp to replace with IMAGE.  IMAGE is t
 (defun smiley-update-cache ()
   (dolist (elt smiley-regexp-alist)
     (let* ((data-directory smiley-data-directory)
-	   (image (find-image (list (list :type 'pbm
-					  :file (nth 2 elt)
-					  :ascent 'center)))))
-      (if image
-	  (push (list (car elt) (cadr elt) image)
+	   (display (if (stringp (nth 2 elt))
+			(find-image (list (list :type 'pbm
+						:file (nth 2 elt)
+						:ascent 'center)))
+		      (nth 2 elt))))
+      (if display
+	  (push (list (car elt) (cadr elt) display)
 		smiley-cached-regexp-alist)))))
 
 (defvar smiley-active nil
@@ -93,7 +106,7 @@ rgexp to replace with IMAGE.  IMAGE is t
 
 ;;;###autoload
 (defun smiley-region (start end)
-  "Display textual smileys as images.
+  "Display textual smileys as images or special characters.
 START and END specify the region; interactively, use the values
 of point and mark.  The value of `smiley-regexp-alist' determines
 which smileys to operate on and which images to use for them."
@@ -109,17 +122,17 @@ which smileys to operate on and which im
     (save-excursion
       (let ((beg (or start (point-min)))
 	    (inhibit-point-motion-hooks t)
-	    group overlay image)
+	    group overlay display)
 	(dolist (entry smiley-cached-regexp-alist)
 	  (setq group (nth 1 entry)
-		image (nth 2 entry))
+		display (nth 2 entry))
 	  (goto-char beg)
 	  (while (re-search-forward (car entry) end t)
-	    (when image
+	    (when display
 	      (setq overlay (make-overlay (match-beginning group)
 					  (match-end group)))
 	      (overlay-put overlay
-			   'display `(when smiley-active ,@image))
+			   'display `(when smiley-active . ,display))
 	      (overlay-put overlay 'mouse-face 'highlight)
 	      (overlay-put overlay 'smiley t)
 	      (overlay-put overlay
@@ -148,7 +161,8 @@ With arg, turn displaying on if and only
 (eval-when-compile (defvar gnus-article-buffer))
 
 (defun gnus-smiley-display (&optional arg)
-  "Display textual emoticaons (\"smilies\") as small graphical icons.
+  "Display textual emoticons (\"smilies\") as small graphical icons.
+May also use strings to display them.  See `smiley-regexp-alist'.
 With arg, turn displaying on if and only if arg is positive."
   (interactive "P")
   (save-excursion

  parent reply	other threads:[~2002-02-11 18:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-31  1:31 Wes Hardaker
2002-02-01  1:48 ` Steve Youngs
2002-02-01 16:53   ` Wes Hardaker
2002-02-11 11:56     ` Han Pilmeyer
2002-02-11 20:26       ` Steve Youngs
2002-02-12 15:30         ` Han Pilmeyer
2002-02-13 15:32           ` Wes Hardaker
2002-02-11 18:43 ` Dave Love [this message]
2002-02-12 16:18   ` That old flamewar again [was Re: recent smiley.el changes] Jan Vroonhof
2002-02-20 19:52     ` Dave Love
2002-02-20 19:52     ` Dave Love
2002-02-22 18:24       ` Per Abrahamsen
2002-02-22 18:24       ` Per Abrahamsen
2002-02-27 19:59         ` Dave Love
2002-02-27 19:59         ` Dave Love
2002-02-24 14:15       ` Fabrice Popineau
2002-02-24 14:15       ` Fabrice Popineau
2002-02-26 16:11         ` Kai Großjohann
2002-02-27 19:18           ` Fabrice Popineau
2002-02-27 19:18           ` Fabrice Popineau
2002-02-26 16:11         ` Kai Großjohann
2002-02-27 20:10         ` Dave Love
2002-02-27 21:25           ` Kai Großjohann
2002-02-27 21:25           ` Kai Großjohann
2002-03-04  7:51             ` Fabrice Popineau
2002-03-04  7:51             ` Fabrice Popineau
2002-02-27 20:10         ` Dave Love

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

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

  git send-email \
    --in-reply-to=rzqit93eu60.fsf@djlvig.dl.ac.uk \
    --to=d.love@dl.ac.uk \
    --cc=ding@gnus.org \
    /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.
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 NNTP newsgroup(s).