From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-mode and longlines-mode (especially tables) Date: Mon, 26 Mar 2007 18:22:52 +0200 Message-ID: <1551a6a92d79540411910ec89deaff7a@science.uva.nl> References: <1242f34a0703171843x3492f1c0ybba68d0b24e90cdb@mail.gmail.com> <2706EFF0-8539-4A46-8C0A-376A7D44D15C@dovdox.com> <34679f9877667a84d6fc17eb4ef5510b@science.uva.nl> <1242f34a0703241851s20a27113jad5fcc09c88b1f3a@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HVtsq-0002Es-RH for emacs-orgmode@gnu.org; Mon, 26 Mar 2007 14:25:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HVtso-0002Df-Ri for emacs-orgmode@gnu.org; Mon, 26 Mar 2007 14:25:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVtso-0002DS-Hw for emacs-orgmode@gnu.org; Mon, 26 Mar 2007 13:25:30 -0500 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HVtqX-0000lR-9f for emacs-orgmode@gnu.org; Mon, 26 Mar 2007 14:23:09 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org Turns out you cannot advise insert because the byte-compiler treats it in a special way. So this will only work if you do not compile org.el to org.elc. If you remove org.elc and also any internal org.elc Emacs might be distributed with, then the advice will work - but you have to pay a speed penalty in Org-mode. - Carsten On Mar 26, 2007, at 17:34, Carsten Dominik wrote: > Hmmmm, the other day I had a working version, but you are right, what I > posted does not work. I don't understand yet why - I'll be back about > this. > > - Carsten > > On Mar 25, 2007, at 3:51, Mark Aufflick wrote: > >> Damn - defadvice is way cool! I do similar AOP-style things in Perl, >> but nothing that clean or simple. >> >> Having said that, it doesn't seem effective for me. It compiles fine >> (in my .emacs), but there is no change in functionality. I tried with >> org-mode 4.6.7 and then upgraded to .9. gnu emacs 22.0.94.1 >> >> I'm not familiar with the calling syntax of defadvice, so I'll keep >> playing. >> >> Thanks very much for the code. >> >> Mark. >> >> >> On 3/23/07, Carsten Dominik wrote: >>> >>> On Mar 19, 2007, at 13:46, Alan Dove wrote: >>> >>> > Hey, folks: >>> > >>> > I've also been using org-mode with longlines-mode, and had noticed >>> > that the two occasionally conflict. I've just developed workarounds >>> > for the bugs that affect me, mostly inserting extra carriage >>> returns >>> > here and there to ensure the right line breaks for org-mode. >>> Carsten, >>> > if you have the option of minimizing these conflicts, that would be >>> > great. >>> >>> I think this is really really hard. Basically, I would have to >>> change >>> all places where Org-mode inserts newlines that should be hard. >>> >>> Hmmm, maybe all newlines that org-mode inserts during internal >>> commands >>> should be hard? >>> >>> In this case, a brute-force solution might do the trick. This is not >>> well tested, >>> but it does make tables work as long as they are not broader than >>> fill >>> column: >>> >>> (defadvice insert (around make-org-mode-newlines-hard activate) >>> "Make sure all org-mode functions insert hard newlines." >>> (if (and (eq major-mode 'org-mode) >>> (boundp 'longlines-mode) longlines-mode >>> (equal "org-" (substring (symbol-name this-command) 0 4))) >>> (let ((_beg (point))) >>> ad-do-it >>> (longlines-decode-region _beg (point))) >>> ad-do-it)) >>> >>> (defadvice insert-before-markers (around make-org-mode-newlines-hard >>> activate) >>> "Make sure all org-mode functions insert hard newlines." >>> (if (and (eq major-mode 'org-mode) >>> (boundp 'longlines-mode) longlines-mode >>> (equal "org-" (substring (symbol-name this-command) 0 4))) >>> (let ((_beg (point))) >>> ad-do-it >>> (longlines-decode-region _beg (point))) >>> ad-do-it)) >>> >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> >> >> >> -- >> Mark Aufflick >> e: mark@pumptheory.com >> w: mark.aufflick.com >> p: +61 438 700 647 >> f: +61 2 9436 4737 >> >> > > -- > Carsten Dominik > Sterrenkundig Instituut "Anton Pannekoek" > Universiteit van Amsterdam > Kruislaan 403 > NL-1098SJ Amsterdam > phone: +31 20 525 7477 > > -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477