From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jsbien@mimuw.edu.pl (Janusz S. =?iso-8859-2?q?Bie=F1?=) Newsgroups: gmane.emacs.devel Subject: a contribution and some questions Date: 22 Jul 2002 07:52:02 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <8765z88g3h.fsf@mimuw.edu.pl> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1027313677 9830 127.0.0.1 (22 Jul 2002 04:54:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 22 Jul 2002 04:54:37 +0000 (UTC) Cc: "Janusz S. =?iso-8859-2?q?Bie=F1?=" , Joanna Pluta Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17WVDP-0002YQ-00 for ; Mon, 22 Jul 2002 06:54:35 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17WVR5-0001Z1-00 for ; Mon, 22 Jul 2002 07:08:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17WVDD-0007dj-00; Mon, 22 Jul 2002 00:54:23 -0400 Original-Received: from duch.mimuw.edu.pl ([193.0.96.2]) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17WVCV-0007dP-00 for ; Mon, 22 Jul 2002 00:53:39 -0400 Original-Received: (qmail 29656 invoked by uid 83); 22 Jul 2002 04:53:36 -0000 Original-Received: from ws4040a.mimuw.edu.pl (HELO grafem.mimuw.edu.pl) (root@10.1.2.52) by duch.mimuw.edu.pl with SMTP; 22 Jul 2002 04:53:31 -0000 Original-Received: by ws4040a.mimuw.edu.pl via sendmail from stdin id (Debian Smail3.2.0.114) for joanna_p@poczta.gazeta.pl; Mon, 22 Jul 2002 06:53:33 +0200 (CEST) Original-To: Emacs development discussions Original-Lines: 40 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.90 X-Virus-Scanned: by AMaViS perl-11 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5961 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5961 --=-=-= On behalf of my student Joanna Pluta I contribute the revised version of `buffers-charsets.el'. Its earlier version has been posted on gnu.emacs.sources on 9.04.2002. Both myself and my colleagues find `buffers-charsets.el' very useful for sorting out confusion about the characters used in a buffer (especially when characters from different charsets look the same). The questions are: 1. Who is the right person to complain about the malfunction of gnu.emacs.sources news-mail gateway? I subscribe to it as a mailing list and never seen the posting mentioned above and probably many others. 2. What is the best way to enforce the proper indentation in a Lisp file, especially in a case when it is an existing file which is being subject to some changes? Best regards Janusz --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=buffer-charsets.el Content-Description: contribution to GNU Emacs ;;; buffer-charsets.el --- show usage of charsets in a buffer ;; Copyright (C) 2002 Joanna Pluta. ;; Keywords: mule, hi-lock ;; This file is [not yet] part of GNU Emacs. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; A copy of the GNU General Public License can be obtained from this ;; program's author (send electronic mail to ) or ;; from the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, ;; MA 02139, USA. ;;; Commentary: ;; - display-buffer-charsets ;; Displays list of charsets used in current buffer. ;; - show-buffer-charset-characters C-x w c ;; Uses hi-lock-mode to highlight in current buffer characters ;; from chosen charset. ;; Creates and adds to local history (hi-lock-interactive-patterns) ;; regexpx matching characters from a given charset. ;; Characters from different charsets can be highlighted by ;; different colors according to chosen face. ;; - unhighlight-charset C-x w u ;; unhighlights characters from given charset ;; ;;; Code: ;;; (require 'hi-lock) (defun charset-chars-regexp (charset) (let ((dim (charset-dimension charset)) (chars (charset-chars charset)) (plane (charset-iso-graphic-plane charset)) min max) (cond ((eq charset 'eight-bit-control) (setq min 128 max 159)) ((eq charset 'eight-bit-graphic) (setq min 160 max 255)) (t (if (= chars 94) (setq min 33 max 126) (setq min 32 max 127)) (or (= plane 0) (setq min (+ min 128) max (+ max 128))))) (if (= dim 1) (format "[%c-%c]" (make-char charset min) (make-char charset max)) (format "[%c-%c]" (make-char charset min min) (make-char charset max max))))) (defun buffer-charsets () (find-charset-region (point-min) (point-max))) (defun display-buffer-charsets () "Displays list of charsets used in current buffer" (interactive) (let ((charsets (buffer-charsets)) (curr-buf-name (current-buffer))) (with-output-to-temp-buffer "*Buffer Charsets*" (save-excursion (set-buffer standard-output) (insert (format "Buffer %s uses the following charsets:\n" curr-buf-name)) (while charsets (insert (symbol-name (car charsets))) (insert "\n") (setq charsets (cdr charsets))))))) (defun charset-alist (charset-list) (let ((l (charset-list)) charset-alist) (while l (setq charset-alist (cons (list (symbol-name (car l))) charset-alist)) (setq l (cdr l))) charset-alist)) (defun show-buffer-charset-characters (charset face) "Uses hi-lock-mode to highlight by face characters of charset." (interactive (let ((completion-ignore-case t)) (list (completing-read "Charset:" (charset-alist (buffer-charsets)) nil t nil nil) (hi-lock-read-face-name)))) (highlight-regexp (charset-chars-regexp (intern charset)) face)) (defun unhighlight-charset (charset) (interactive (let ((completion-ignore-case t)) (list (completing-read "Charset:" (charset-alist (buffer-charsets)) nil t nil nil)))) (unhighlight-regexp (charset-chars-regexp (intern charset)))) (define-key hi-lock-map "\C-xwc" 'show-buffer-charset-characters) (define-key hi-lock-map "\C-xwu" 'unhighlight-charset) ;;; mule-utils.el ends here --=-=-= -- , dr hab. Janusz S. Bien, prof. UW Prof. Janusz S. Bien, Warsaw Uniwersity http://www.orient.uw.edu.pl/~jsbien/ --------------------------------------------------------------------- Na tym koncie czytam i wysylam poczte i wiadomosci offline. On this account I read/post mail/news offline. --=-=-=--