From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.devel Subject: Re: Patch to bookmark.el Date: Wed, 21 Dec 2011 00:03:44 +0100 Message-ID: <1324422224.1891.12.camel@localhost.localdomain> References: <87zkeqhod2.fsf@floss.red-bean.com> <87pqfmcupi.fsf@floss.red-bean.com> <1324329297.5507.12.camel@localhost.localdomain> <87vcpbi05a.fsf@kwarm.red-bean.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-w/BNkH5BZFbNpORhUXjV" X-Trace: dough.gmane.org 1324421518 22016 80.91.229.12 (20 Dec 2011 22:51:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Dec 2011 22:51:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Karl Fogel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 20 23:51:53 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rd8XJ-0001Ok-7o for ged-emacs-devel@m.gmane.org; Tue, 20 Dec 2011 23:51:53 +0100 Original-Received: from localhost ([::1]:46724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd8XI-0001vZ-KL for ged-emacs-devel@m.gmane.org; Tue, 20 Dec 2011 17:51:52 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:55867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd8XE-0001vR-Hu for emacs-devel@gnu.org; Tue, 20 Dec 2011 17:51:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rd8XC-00062C-Pt for emacs-devel@gnu.org; Tue, 20 Dec 2011 17:51:48 -0500 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:57677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd8XC-00061y-DM for emacs-devel@gnu.org; Tue, 20 Dec 2011 17:51:46 -0500 Original-Received: by eekc41 with SMTP id c41so7268668eek.0 for ; Tue, 20 Dec 2011 14:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version; bh=WxgTWC1Vq7s3ZXnDdQmlUwnYagVXpIwFM25pcW5e4AY=; b=Qf6ma4qqdvly+Utzd1T+6CO66VTRKhG+vH3ZMuYWJWEq0yJ29rTj2S2pFRtoLIfowi LCLa/fsF3qgev8uNfMVB5CgQ/xiadB/eYxKXuusdRZfYYRivXwRelis2pruXZplKn+k4 yWFqf3SaF6DjUIJF47ittoKWXyhv319zuzSfo= Original-Received: by 10.213.13.146 with SMTP id c18mr925123eba.89.1324421505010; Tue, 20 Dec 2011 14:51:45 -0800 (PST) Original-Received: from [192.168.1.38] (jau31-3-82-239-20-84.fbx.proxad.net. [82.239.20.84]) by mx.google.com with ESMTPS id 13sm12789105eeu.1.2011.12.20.14.51.42 (version=SSLv3 cipher=OTHER); Tue, 20 Dec 2011 14:51:43 -0800 (PST) In-Reply-To: <87vcpbi05a.fsf@kwarm.red-bean.com> X-Mailer: Evolution 3.2.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146888 Archived-At: --=-w/BNkH5BZFbNpORhUXjV Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit > Sorry -- I don't know what happend, but I only ever got one version from > you (as far as I know), which is the one my patch was based on. Don't be sorry; I have many troubles with the ethernet card of my laptop and won't be surprised if the mails I sent to you were not sent at all... Here are log files and patches. Note that header-line.patch is the result of a diff against the latest pristine bookmark.el; But dedicated-faces.patch was made after header-line.patch was applied to bookmark.el. Tell me if you are expecting anything else. Have a nice day, -- Matthias --=-w/BNkH5BZFbNpORhUXjV Content-Disposition: attachment; filename="header-line.log" Content-Type: text/x-log; name="header-line.log"; charset="UTF-8" Content-Transfer-Encoding: 7bit [[[ Display the bookmark list header similarly to the buffer list header (see `list-buffers'), where the default is now an immovable/immutable header line. Patch by: Matthias Meulien Karl Fogel * lisp/bookmark.el (bookmark-bmenu-use-header-line): New variable. (bookmark-bmenu-inline-header-height): New name for `bookmark-bmenu-header-height', to avoid confusion with the code for the new immovable header. All references changed. (bookmark-bmenu-set-header): New function. (bookmark-bmenu-list, bookmark-bmenu-toggle-filenames): Conditionalize header construction accordingly. (bookmark-bmenu-ensure-position): Conditionalize the skipping of the inline header height. (bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames): Conditionalize the skipping of the inline header height. ]]] --=-w/BNkH5BZFbNpORhUXjV Content-Disposition: attachment; filename="header-line.patch" Content-Type: text/x-patch; name="header-line.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit diff --git a/bookmark.el b/bookmark.el index 4d93e01..99816d2 100644 --- a/bookmark.el +++ b/bookmark.el @@ -127,9 +127,15 @@ recently set ones come first, oldest ones come last)." :type 'boolean :group 'bookmark) +(defcustom bookmark-bmenu-use-header-line t + "Non-nil means to use an immovable header line, as opposed to inline +text at the top of the buffer." + :type 'boolean + :group 'bookmark) -(defconst bookmark-bmenu-header-height 2 - "Number of lines used for the *Bookmark List* header.") +(defconst bookmark-bmenu-inline-header-height 2 + "Number of lines used for the *Bookmark List* header +\(only significant when `bookmark-bmenu-use-header-line' is nil\).") (defconst bookmark-bmenu-marks-width 2 "Number of columns (chars) used for the *Bookmark List* marks column, @@ -1543,7 +1549,8 @@ deletion, or > if it is flagged for displaying." (set-buffer buf))) (let ((inhibit-read-only t)) (erase-buffer) - (insert "% Bookmark\n- --------\n") + (if (not bookmark-bmenu-use-header-line) + (insert "% Bookmark\n- --------\n")) (add-text-properties (point-min) (point) '(font-lock-face bookmark-menu-heading)) (dolist (full-record (bookmark-maybe-sort-alist)) @@ -1568,8 +1575,10 @@ deletion, or > if it is flagged for displaying." (insert "\n"))) (set-buffer-modified-p (not (= bookmark-alist-modification-count 0))) (goto-char (point-min)) - (forward-line 2) (bookmark-bmenu-mode) + (if bookmark-bmenu-use-header-line + (bookmark-bmenu-set-header) + (forward-line bookmark-bmenu-inline-header-height)) (if bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t)))) @@ -1578,7 +1587,25 @@ deletion, or > if it is flagged for displaying." ;;;###autoload (defalias 'edit-bookmarks 'bookmark-bmenu-list) - +(defun bookmark-bmenu-set-header () + "Sets the immutable header line." + (let ((header (concat "%% " "Bookmark"))) + (when bookmark-bmenu-toggle-filenames + (setq header (concat header + (make-string (- bookmark-bmenu-file-column + (- (length header) 3)) ?\s) + "File"))) + (let ((pos 0)) + (while (string-match "[ \t\n]+" header pos) + (setq pos (match-end 0)) + (put-text-property (match-beginning 0) pos 'display + (list 'space :align-to (- pos 1)) + header))) + (put-text-property 0 2 'face 'fixed-pitch header) + (setq header (concat (propertize " " 'display '(space :align-to 0)) + header)) + ;; Code derived from `buff-menu.el'. + (setq header-line-format header))) (define-derived-mode bookmark-bmenu-mode special-mode "Bookmark Menu" "Major mode for editing a list of bookmarks. @@ -1631,7 +1658,9 @@ Optional argument SHOW means show them unconditionally." (setq bookmark-bmenu-toggle-filenames nil)) (t (bookmark-bmenu-show-filenames) - (setq bookmark-bmenu-toggle-filenames t)))) + (setq bookmark-bmenu-toggle-filenames t))) + (when bookmark-bmenu-use-header-line + (bookmark-bmenu-set-header))) (defun bookmark-bmenu-show-filenames (&optional force) @@ -1644,7 +1673,8 @@ mainly for debugging, and should not be necessary in normal use." (save-excursion (save-window-excursion (goto-char (point-min)) - (forward-line 2) + (if (not bookmark-bmenu-use-header-line) + (forward-line bookmark-bmenu-inline-header-height)) (setq bookmark-bmenu-hidden-bookmarks ()) (let ((inhibit-read-only t)) (while (< (point) (point-max)) @@ -1672,7 +1702,8 @@ mainly for debugging, and should not be necessary in normal use." (with-buffer-modified-unmodified (save-excursion (goto-char (point-min)) - (forward-line 2) + (if (not bookmark-bmenu-use-header-line) + (forward-line bookmark-bmenu-inline-header-height)) (setq bookmark-bmenu-hidden-bookmarks (nreverse bookmark-bmenu-hidden-bookmarks)) (let ((inhibit-read-only t)) @@ -1696,9 +1727,11 @@ mainly for debugging, and should not be necessary in normal use." "If point is not on a bookmark line, move it to one. If before the first bookmark line, move to the first; if after the last full line, move to the last full line. The return value is undefined." - (cond ((< (count-lines (point-min) (point)) bookmark-bmenu-header-height) + (cond ((and (not bookmark-bmenu-use-header-line) + (< (count-lines (point-min) (point)) + bookmark-bmenu-inline-header-height)) (goto-char (point-min)) - (forward-line bookmark-bmenu-header-height)) + (forward-line bookmark-bmenu-inline-header-height)) ((and (bolp) (eobp)) (beginning-of-line 0)))) --=-w/BNkH5BZFbNpORhUXjV Content-Disposition: attachment; filename="dedicated-faces.log" Content-Type: text/x-log; name="dedicated-faces.log"; charset="UTF-8" Content-Transfer-Encoding: 7bit [[[ Define a face to highlight bookmark names in bookmark menu buffers, where the default is a bold face similarly to buffer names in buffer menu buffers. Patch by: Matthias Meulien Karl Fogel * lisp/bookmark.el (bookmark-menu-bookmark): New face to highlight bookmark names. (bookmark-insert-location): Removes dupplicated text property to conform to buffer list (see `list-buffers') (bookmark-bmenu-list, bookmark-bmenu-hide-filenames): Apply face `bookmark-menu-bookmark' to bookmark names. ]]] --=-w/BNkH5BZFbNpORhUXjV Content-Disposition: attachment; filename="dedicated-faces.patch" Content-Type: text/x-patch; name="dedicated-faces.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit diff --git a/bookmark.el b/bookmark.el index 99816d2..d27fd46 100644 --- a/bookmark.el +++ b/bookmark.el @@ -157,6 +157,10 @@ following in your `.emacs' file: :type 'boolean :group 'bookmark) +(defface bookmark-menu-bookmark + '((t (:weight bold))) + "Face used to highlight bookmark names in bookmark menu buffers." + :group 'bookmark) (defcustom bookmark-menu-length 70 "Maximum length of a bookmark name displayed on a popup menu." @@ -1178,18 +1182,7 @@ Optional second arg NO-HISTORY means don't record this in the minibuffer history list `bookmark-history'." (interactive (list (bookmark-completing-read "Insert bookmark location"))) (or no-history (bookmark-maybe-historicize-string bookmark-name)) - (let ((start (point))) - (prog1 - (insert (bookmark-location bookmark-name)) - (if (display-mouse-p) - (add-text-properties - start - (save-excursion (re-search-backward - "[^ \t]") - (1+ (point))) - '(mouse-face highlight - follow-link t - help-echo "mouse-2: go to this bookmark in other window")))))) + (insert (bookmark-location bookmark-name))) ;;;###autoload (defalias 'bookmark-locate 'bookmark-insert-location) @@ -1569,7 +1562,8 @@ deletion, or > if it is flagged for displaying." (when (display-mouse-p) (add-text-properties (+ bookmark-bmenu-marks-width start) end - '(mouse-face highlight + '(font-lock-face bookmark-menu-bookmark + mouse-face highlight follow-link t help-echo "mouse-2: go to this bookmark in other window"))) (insert "\n"))) @@ -1717,8 +1711,9 @@ mainly for debugging, and should not be necessary in normal use." (if (display-mouse-p) (add-text-properties start (point) - '(mouse-face - highlight follow-link t help-echo + '(font-lock-face bookmark-menu-bookmark + mouse-face highlight + follow-link t help-echo "mouse-2: go to this bookmark in other window")))) (forward-line 1))))))) --=-w/BNkH5BZFbNpORhUXjV--