From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: ruler support in hexl mode Date: 12 Mar 2004 16:24:43 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20040312.150538.157235451.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1079145927 10016 80.91.224.253 (13 Mar 2004 02:45:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Mar 2004 02:45:27 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Mar 13 03:45:19 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1z9L-00059I-00 for ; Sat, 13 Mar 2004 03:45:19 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1z9K-0004UB-01 for ; Sat, 13 Mar 2004 03:45:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B1ysj-0001OX-Pg for emacs-devel@quimby.gnus.org; Fri, 12 Mar 2004 21:28:09 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B1xVB-0002lw-KD for emacs-devel@gnu.org; Fri, 12 Mar 2004 19:59:45 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B1xS0-000233-3B for emacs-devel@gnu.org; Fri, 12 Mar 2004 19:56:59 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B1u9F-0002eF-Ck for emacs-devel@gnu.org; Fri, 12 Mar 2004 16:24:53 -0500 Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 2368720FCD; Fri, 12 Mar 2004 16:24:44 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id CF3948C8E4; Fri, 12 Mar 2004 16:24:43 -0500 (EST) Original-To: Masatake YAMATO In-Reply-To: <20040312.150538.157235451.jet@gyve.org> Original-Lines: 62 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.9, requis 5, BAYES_00 -4.90) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20369 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20369 > Based on Stefan and Kim's suggestions, I have revised the patch. > I've moved the essential functions(`scroll-bar-columns' and `fringe-columns') > in ruler-mode.el to frame.el and fringe.el and use new functions in > ruler-mode.el and hexl.el. Comments: > +(defcustom hexl-use-ruler t > + "If non-nil then show the ruler for hexl mode." > + :type 'boolean > + :group 'hexl) I'd call it hexl-use-header-line, but maybe that's just me. > +(defface hexl-ascii-overlay > + ;; Definition borrowed from vcursor.el. > + '((((class color)) (:foreground "blue" :background "cyan" :underline t)) > + (t (:inverse-video t :underline t))) > + "Face for the overlay in ascii area of hexl mode buffer." > + :group 'hexl) I'd call it `hexl-ascii-cursor' since the user might not know it's an overlay (and it could actually be implemented as a text-property tomorrow). Also I'd stick to just `:inverse-video' as much as possible or more specifically I'd try to make it look just like the normal cursor (since there's conceptually no difference between the two). > +(defcustom hexl-follow-line t > + "If non-nil then turn `hl-line-mode' on." > + :type 'boolean > + :group 'hexl) [...] > + (if hexl-follow-line (hexl-follow-line 1))) > (run-hooks 'hexl-mode-hook)) [...] > +(defun hexl-follow-line (&optional arg) > + "Toggle following line address in Hexl buffers. > +With prefix ARG, turn on following if and only if ARG is positive. > +When following is enabled, the line address corresponding to the > +element under the point is highlighted. > +Customize the variable `hexl-follow-line' to disable this feature." > + (interactive "P") > + (let ((on-p (if arg > + (> (prefix-numeric-value arg) 0) > + (not hexl-follow-line)))) > + > + (setq hexl-follow-line on-p) > + (hl-line-mode (if on-p 1 -1)))) You could define this with `define-minor-mode'. But I'd recommend to go even further and replace the above with: (defcustom hexl-mode-hook () "Blabla" :type 'hook :options '(hexl-follow-line)) (defun hexl-follow-line () (hl-line-mode 1)) -- Stefan