From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.devel Subject: [Footnote-mode]: alignment option [CODE included] Date: Thu, 7 Dec 2017 01:18:01 -0500 Message-ID: <20171207061801.6ym3aeukjl3arlmg@E15-2016.optimum.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lzt2yrvhgvdzwldx" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1512632624 18339 195.159.176.226 (7 Dec 2017 07:43:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Dec 2017 07:43:44 +0000 (UTC) User-Agent: NeoMutt/20170609 (1.8.3) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 07 08:43:37 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMqqF-0004YM-Jm for ged-emacs-devel@m.gmane.org; Thu, 07 Dec 2017 08:43:35 +0100 Original-Received: from localhost ([::1]:59392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMqqM-0005aj-Kd for ged-emacs-devel@m.gmane.org; Thu, 07 Dec 2017 02:43:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMpVc-0000EC-BH for emacs-devel@gnu.org; Thu, 07 Dec 2017 01:18:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMpVZ-0003vT-0U for emacs-devel@gnu.org; Thu, 07 Dec 2017 01:18:12 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:50622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eMpVY-0003un-Ld for emacs-devel@gnu.org; Thu, 07 Dec 2017 01:18:08 -0500 Original-Received: from E15-2016.optimum.net ([108.6.168.221]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MVZuV-1eZgtX3lFv-00YzHJ for ; Thu, 07 Dec 2017 07:18:05 +0100 Content-Disposition: inline X-Provags-ID: V03:K0:WvqNedUm2wBW3dTUZcP3+glwCTypOBPoH/orGxpnTkUqaViml9b +cgee0qKLdroGEMVrRi4TMhOX+N6fp3ze1iLsEvpi+dLv2aCHjDxYoK9kHq8gP81T/Tyf/c glS6aYRPN/FLpT0teZI9jRLkZQbocjIGkCAhgExVW8qYrmcvXVwlAsnrk6+d4Oh2zlPpdkc LSO4P7cLgRzynnpcD1V6A== X-UI-Out-Filterresults: notjunk:1;V01:K0:sA6T9JKC7/Y=:M/6ZR8Faw8/tgUzoQXbhQ+ ypd4zin/RHAvKzRrY56s3Y0cEP0FPenumx0v6IHXyFrne2vCOVvVI7pfpHte6mspmQQR/Aunx ww1i8U+CwgQw/86mmkzUltImzsBNSVlFTYsKb4LvuvjQA+Z/VFuS2P9YRtrt7awcBRbF+qADg 3XRo/f8z1SSLWIqUj8h8uUsWBgx2wDa55tXAnkOu14AI/FEV1AYbQk0K44z+JoUNjZsTOpZiO bxntb124RLTmz47zhxe69ysYy/W6cgRS9SVMe8ssM0EPTBFddbANZxzZRD0svQAV/XT3PZZkS Lr0faXMRcDvBk2MQoz4W+NddHRg6+kXu/htNDZej4VBrLBC6IFJbvmie/nexAko6vyl3HWJni HyUJURYEYeXdUeDHfMyErrr2JPTm+FB1kdFZUw4sEIvzPjBvIcNmWfCTew8vpaSn8zfmxl3t3 xdDhDeSAidIbpBBYo/Kxdo1RWgy0Cx+xyflD1WBAk7cEFHhNWns6VDBxi+V4EFSlxtkRA475G EzkkoE1oU9u1RCnFtwAKgPJXs2yeWKPnxuuY7zHnVSnKHXBcrTLajmKFi2saoqGiSHKVL0eTX fcJW4SNG5q0tUjN8MdCJAGTr+8Paf1A7OmIzEus8NE2NAfy4SVupZw3dc/07WUoCpl1jNJOA2 qwvbkZ0aKaHW6ILPGS5Na8qmyHL1BhNqs6vk+T+ZrO8ucLh2suWi11xUBLsyasEQ47E4O4SaC leZdvWu+lOzOOyjGJG3422pNFK2nMtkwhbJfPtExb4kqO90gZOrojEzu8H9Tdl6MsRhRNXnC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.21 X-Mailman-Approved-At: Thu, 07 Dec 2017 02:43:31 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:220777 Archived-At: --lzt2yrvhgvdzwldx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. I'm not a member of the list, but I wanted to share some code that I think would be useful for emacs users... The attached code allows one to left-justify footnote text from the first column of text, instead of from the left margin. I find this aesthetically preferable, especially when I have long footnotes. Once the code is evaluated and one has footnote-mode enabled, `C-c ! q' toggles the feature. Then, whenever one performs an auto-fill, `M-q'', feature acts. Of course, if one has visual-line-mode enabled, the auto-fill acts automatically. The current code is set up as defadvice-s (that's how long I've ended up sitting on it), but if emacs wants it integrated into the mode, there's no need for that. -- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --lzt2yrvhgvdzwldx Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="footnote-snippet.el" Content-Transfer-Encoding: 8bit ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ; Footnote behavior customization ; + left-align footnote text to first character of first paragraph, ; not to left margin. ; + Instructions: ; + toggle the feature using 'mode-map-prexic q' (usually 'C-c ! q') ; + whenever you run `auto-fill' (M-q), it will act ; + if you set visual-line-mode, it acts automatically (require 'footnote) (setq Footnote-align-to-fn-text t body-auto-fill-prefix nil) (defun Footnote-calc-fn-alignment-column() (+ footnote-body-tag-spacing (length (concat footnote-start-tag footnote-end-tag (Footnote-index-to-string (caar (last footnote-text-marker-alist))))))) (defun Footnote-align-to-fn() (when Footnote-align-to-fn-text (setq body-auto-fill-prefix fill-prefix fill-prefix (make-string (Footnote-calc-fn-alignment-column) 32)))) (defun Footnote-align-to-body() (when (not Footnote-align-to-fn-text) (setq fill-prefix body-auto-fill-prefix))) (defun Footnote-toggle-alignment() (interactive) (setq Footnote-align-to-fn-text (not Footnote-align-to-fn-text)) (when footnote-text-marker-alist (if (>= (point) (cdr (first footnote-text-marker-alist))) (if Footnote-align-to-fn-text (Footnote-align-to-fn) (Footnote-align-to-body)))) (if Footnote-align-to-fn-text (message "Footnotes will left-align to footnote text") (message "Footnotes will left-align to body text"))) (define-key footnote-mode-map (kbd "q") 'Footnote-toggle-alignment) (defadvice Footnote-add-footnote (after update-auto-fill-prefix activate) (interactive) (Footnote-align-to-fn)) (defadvice Footnote-back-to-message (after restore-auto-fill-prefix activate) (interactive) (setq fill-prefix body-auto-fill-prefix)) (defadvice Footnote-add-footnote (around abort-when-in-fn-area activate) (interactive) (if (or (not footnote-text-marker-alist) (< (point) (cdr (first footnote-text-marker-alist)))) ad-do-it (message "Add footnotes only while in text body"))) ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --lzt2yrvhgvdzwldx--