From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Frederik Newsgroups: gmane.emacs.help Subject: Make defadvice mode local Date: Sun, 03 Nov 2013 14:14:31 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1383484504 9940 80.91.229.3 (3 Nov 2013 13:15:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Nov 2013 13:15:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 03 14:15:09 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1VcxWG-0006mD-VW for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Nov 2013 14:15:09 +0100 Original-Received: from localhost ([::1]:45161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcxWG-000429-Hq for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Nov 2013 08:15:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcxW0-00041o-Ob for help-gnu-emacs@gnu.org; Sun, 03 Nov 2013 08:14:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcxVq-0005c6-Lw for help-gnu-emacs@gnu.org; Sun, 03 Nov 2013 08:14:52 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:37548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcxVq-0005bu-FF for help-gnu-emacs@gnu.org; Sun, 03 Nov 2013 08:14:42 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VcxVo-0006UM-To for help-gnu-emacs@gnu.org; Sun, 03 Nov 2013 14:14:40 +0100 Original-Received: from dslb-094-218-044-056.pools.arcor-ip.net ([94.218.44.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Nov 2013 14:14:40 +0100 Original-Received: from freak.fred by dslb-094-218-044-056.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Nov 2013 14:14:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-094-218-044-056.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94303 Archived-At: Hello lisp hackers, I found the following snippet on the web which changes the filling of paragraphs in LaTeX documents such that each sentence begins on a new line: ---------------8<------------------------------------------------------ ;; Start each sentence on a new line when editing LaTex source files ;; http://pleasefindattached.blogspot.de/2011/12/emacsauctex-sentence-fill-greatly.html (defadvice LaTeX-fill-region-as-paragraph (around LaTeX-sentence-filling) "Start each sentence on a new line." (let ((from (ad-get-arg 0)) (to-marker (set-marker (make-marker) (ad-get-arg 1))) tmp-end) (while (< from (marker-position to-marker)) (forward-sentence) ;; might have gone beyond to-marker --- use whichever is smaller: (ad-set-arg 1 (setq tmp-end (min (point) (marker-position to-marker)))) ad-do-it (ad-set-arg 0 (setq from (point))) (unless (or (bolp) (looking-at "\\s *$")) (LaTeX-newline))) (set-marker to-marker nil))) (ad-activate 'LaTeX-fill-region-as-paragraph) ; to activate ;;(ad-deactivate 'LaTeX-fill-region-as-paragraph) ; to deactivate ---------------8<------------------------------------------------------ However, I want that this behaviour only gets activated in documents which are under version control. So I seek a way to only activate the advice in buffers with vc-mode enabled... I don't know where to start as I practically don't know any lisp; but I fear that this defadvice only can be enabled globally to all LaTeX buffers... Any pointers? Regards, Fred -- Frederik