From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?B?Tm9yZGz2dw==?= Newsgroups: gmane.emacs.help Subject: Extending the concept of pretty-greek with icons/images Date: Wed, 05 Sep 2007 04:30:13 -0700 Organization: http://groups.google.com Message-ID: <1188991813.125435.171000@g4g2000hsf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1188992431 27693 80.91.229.12 (5 Sep 2007 11:40:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Sep 2007 11:40:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 05 13:40:30 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IStFF-0005B1-Tp for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Sep 2007 13:40:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IStFE-00005s-AC for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Sep 2007 07:40:28 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!g4g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-NNTP-Posting-Host: 150.227.15.253 Original-X-Trace: posting.google.com 1188991813 13055 127.0.0.1 (5 Sep 2007 11:30:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 5 Sep 2007 11:30:13 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 netcache (NetCache NetApp/6.1.1RC1) Complaints-To: groups-abuse@google.com Injection-Info: g4g2000hsf.googlegroups.com; posting-host=150.227.15.253; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:151705 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:47230 Archived-At: We humans are very good at recognizing content based on images and shapes, often more efficiently than we recognize words, at least when the words are long. For this reason a text written in chinese and/or japanese can more efficiently ("with a higher bandwidth") explain a concept to to the reader than is possible with (western) alphabets. When reading source code, especially C code, we are often confronted by quite long function names, especially in C environments such as GNOME. These function names are however built up of smaller words or acronyms often separated by underline or capitalization. After having seen the clever Emacs extensions pretty-lamda and pretty-greek (given below) I have gotten a feeling that this concept of "visual abbreviations" could be applied also to these contexts of long C identifiers. I believe this would make reading such C source code easier and more visually attractive. Wanting to try out my idea I thought I could start simple by overlay/change all the gtk_ prefix with a miniturized version of the GTK's main icon seen www.gtk.org (http://www.gtk.org/images/gtk-logo-rgb.gif). Is this possible to do easily in Emacs or do I have to change the internals (C code) of Emacs? Thanks in advance for any reflections or/and help, Nordl=F6w Emacs Lisp Sources for pretty-greek follows. Just add to .emacs, evaluate and restart emacs or do M-x emacs-lisp-mode to activate the hook: ;; Pretty Greek ;; This is BenignoUria modification to Pretty Lambda. Substitutes all ;; greek letter names with its character. Very nice if you use greek ;; letters as parameters in parts of your code. (defun pretty-greek () (let ((greek '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta" "theta" "iota" "kappa" "lambda" "mu" "nu" "xi" "omicron" "pi" "rho" "sigma_final" "sigma" "tau" "upsilon" "phi" "chi" "psi" "omega"))) (loop for word in greek for code =3D 97 then (+ 1 code) do (let ((greek-char (make-char 'greek-iso8859-7 code))) (font-lock-add-keywords nil `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[a-zA-Z]") (0 (progn (decompose-region (match-beginning 2) (match-end 2)) nil))))) (font-lock-add-keywords nil `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[^a-zA-Z]") (0 (progn (compose-region (match-beginning 2) (match-end 2) ,greek-char) nil))))))))) (add-hook 'lisp-mode-hook 'pretty-greek) (add-hook 'emacs-lisp-mode-hook 'pretty-greek) ;; (add-hook 'c-mode-common-hook 'pretty-greek)