From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Schmidt Newsgroups: gmane.emacs.devel Subject: Re: Defaults for elisp-mode files Date: Wed, 3 Oct 2012 19:41:56 +0100 (BST) Message-ID: <87y5jnqtxh@ch.ristopher.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1349289747 8265 80.91.229.3 (3 Oct 2012 18:42:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2012 18:42:27 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 03 20:42:32 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TJTtY-0003vU-AI for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2012 20:42:08 +0200 Original-Received: from localhost ([::1]:32805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTtS-0002uo-F1 for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2012 14:42:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTtP-0002uV-HW for emacs-devel@gnu.org; Wed, 03 Oct 2012 14:42:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJTtO-0001vz-I3 for emacs-devel@gnu.org; Wed, 03 Oct 2012 14:41:59 -0400 Original-Received: from ristopher.com ([146.185.21.93]:60959 helo=saturn.ch.ristopher.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTtO-0001te-9O for emacs-devel@gnu.org; Wed, 03 Oct 2012 14:41:58 -0400 Original-Received: by saturn.ch.ristopher.com (Postfix, from userid 0) id 348671FEA4; Wed, 3 Oct 2012 19:41:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ch.ristopher.com; s=mail; t=1349289716; bh=lR6SXmsjecHxUGRfpHRlS7tR1H/3ENmopIxsr975Cik=; h=From:To:Subject:In-Reply-To:Message-ID:References:MIME-Version: Content-Type:Date; b=AJWSFXai40MbXjsbsSNfvwAGH1LOrV7h7BYBcAyda7Rv9t+tS0wzjVskoC2kWi676 gveeE4g0gpXQj29lc0kkN5ultWdW6NfEWVkbZuMf1/tSa3dobmU4wqHayPliZDgKdv qnWRq3qMrMBQnXWE7Rvl0I38QvCpv7zGbP2Fx8tw= In-Reply-To: (Stefan Monnier's message of "Wed, 03 Oct 2012 14:06:03 -0400") Mail-Followup-To: emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 146.185.21.93 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:154028 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: > So I think in the longer term these annotations should be made > unnecessary because they're ugly. I use a minor mode that hides these annotations. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=my-hide-file-local-variable-prop-line.el Content-Transfer-Encoding: quoted-printable ;; -*- lexical-binding: t; -*- ;; 09/2012: do not make this variable buffer local - major modes might kill= all ;; local variables (defvar my-hide-file-local-variable-prop-line-overlays nil) (define-minor-mode my-global-hide-file-local-variable-prop-line-mode "" nil nil nil :global t (loop for h in '(find-file-hook after-change-major-mode-hook) do (funcall (if my-global-hide-file-local-variable-prop-line-mode 'add-hook 'remove-hook) h (lambda () (my-hide-file-local-variable-prop-line-mode 1)))) (loop for b being the buffers do (with-current-buffer b (my-hide-file-local-variable-prop-line-mode (if my-global-hide-file-local-variable-prop-line-mode 1 -1))))) (define-minor-mode my-hide-file-local-variable-prop-line-mode "" nil " HPL" nil (setf my-hide-file-local-variable-prop-line-overlays (loop for overlay in my-hide-file-local-variable-prop-line-overlays if (eq (overlay-buffer overlay) (current-buffer)) do (delete-overlay overlay) else collect overlay end)) (let ((to-hide)) (when my-hide-file-local-variable-prop-line-mode (save-excursion (goto-char (point-min)) (when (looking-at ".*?\\(-\\*-.+?-\\*-\\)\\(.*\\)\n*") (let ((match-to-use (if (zerop (length (match-string 2))) 0 1))) (push (cons (match-beginning match-to-use) (match-end match-to-use)) to-hide))) (when (search-forward-regexp ;; 09/2012: fix "Local variables list is not properly terminated" ;; by files.el "^\\(\n*\\)?.*Local \ Variables:\n\\([^:]+: [^:]+\n\\)*.*+End:\n\\'" nil t) (push (cons (match-beginning 0) (match-end 0)) to-hide)))) (if (not to-hide) (setf my-hide-file-local-variable-prop-line-mode nil) (loop for (start . end) in to-hide for overlay =3D (make-overlay start end) do (overlay-put overlay 'invisible t) (overlay-put overlay 'isearch-open-invisible (lambda (o) (loop for overlay in my-hide-file-local-variable-prop-line-overlays do (if (eq o overlay) (overlay-put overlay 'invisible nil) (delete-overlay overlay))) (setf my-hide-file-local-variable-prop-line-overlays nil my-hide-file-local-variable-prop-line-mode nil))) (push overlay my-hide-file-local-variable-prop-line-overlays))))) (provide 'my-hide-file-local-variable-prop-line) --=-=-= Content-Type: text/plain Christopher --=-=-=--