From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Williams Subject: [patch] change indentation logic for edit-src Date: Thu, 16 Aug 2012 14:30:06 -0500 Message-ID: <21A5E1E970CD46459ECBE86D6CC4B28C674153FC@spexch01.WindLogics.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="_004_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25ll-0000f8-0s for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:30:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T25lh-0000tB-Ug for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:30:12 -0400 Received: from shrimp.windlogics.com ([216.245.170.164]:5168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T25lh-0000re-MH for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 15:30:09 -0400 Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" --_004_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_ Content-Type: multipart/alternative; boundary="_000_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_" --_000_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Following on a message from a few days ago, I've prepared a patch (attached= ) that alters the behavior of 'org-edit-src-exit' so that it no longer adds= an extra 2 spaces of indentation each time a source block (or a table.el t= able) is edited. Previously a workaround was to set 'org-src-preserve-inde= ntation', but without that set, you'd get the undesirable behavior. There's probably some stuff wrong with this approach - let me know. I'm ne= w to both elisp programming and the org-mode code. I also created a little utility function 'org-prefixify', not sure whether = that's kosher or not. One change that would be nice to make to it is to av= oid prefixing the final line if it's blank, but I couldn't get that to work= . Also - could that essentially be replaced by a call to string-insert-rec= tangle? -- Ken Williams, Senior Research Scientist WindLogics http://windlogics.com ________________________________ CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the inte= nded recipient(s) and may contain confidential and privileged information. = Any unauthorized review, use, disclosure or distribution of any kind is str= ictly prohibited. If you are not the intended recipient, please contact the= sender via reply e-mail and destroy all copies of the original message. Th= ank you. --_000_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Following on a message from a few days ago, I’= ve prepared a patch (attached) that alters the behavior of ‘org-edit-= src-exit’ so that it no longer adds an extra 2 spaces of indentation = each time a source block (or a table.el table) is edited.  Previously a workaround was to set ‘org-src-preserve-indentationR= 17;, but without that set, you’d get the undesirable behavior.

 

There’s probably some stuff wrong with this ap= proach – let me know.  I’m new to both elisp programming a= nd the org-mode code.

 

I also created a little utility function ‘org-= prefixify’, not sure whether that’s kosher or not.  One ch= ange that would be nice to make to it is to avoid prefixing the final line = if it’s blank, but I couldn’t get that to work.  Also - co= uld that essentially be replaced by a call to string-insert-rectangle?

 

--

Ken Williams, Senior Research Scientist

Wind<= /b>Logics

http://windlogics.com

 



CONFIDENTIALITY NOTICE: Th= is e-mail message is for the sole use of the intended recipient(s) and may = contain confidential and privileged information. Any unauthorized review, u= se, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please= contact the sender via reply e-mail and destroy all copies of the original= message. Thank you.
--_000_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_-- --_004_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_ Content-Type: text/plain; name="0001-Change-the-edit-src-save-code-so-that-it-either-pres.txt" Content-Description: 0001-Change-the-edit-src-save-code-so-that-it-either-pres.txt Content-Disposition: attachment; filename="0001-Change-the-edit-src-save-code-so-that-it-either-pres.txt"; size=2564; creation-date="Thu, 16 Aug 2012 19:19:21 GMT"; modification-date="Thu, 16 Aug 2012 19:20:06 GMT" Content-Transfer-Encoding: base64 RnJvbSBkODBiNzcyNjQwMmEzOWI0YzhhNjMwYTg2NjE0YjBiYTlkN2VjYTZhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBLZW4gV2lsbGlhbXMgPEtlbi5XaWxsaWFtc0BXaW5kTG9naWNz LmNvbT4KRGF0ZTogVGh1LCAxNiBBdWcgMjAxMiAxMzoyNjo0NCAtMDUwMApTdWJqZWN0OiBbUEFU Q0hdIENoYW5nZSB0aGUgZWRpdC1zcmMtc2F2ZSBjb2RlIHNvIHRoYXQgaXQgZWl0aGVyIHByZXNl cnZlcwogb3JpZ2luYWwgZm9ybWF0dGluZywgb3IgaW1wb3NlcyBpdHMgbmV3IGluZGVudGF0aW9u LCBidXQKIG5vdCBib3RoLgoKLS0tCiBsaXNwL29yZy1zcmMuZWwgfCAgIDIyICsrKysrKysrKysr LS0tLS0tLS0tLS0KIDEgZmlsZXMgY2hhbmdlZCwgMTEgaW5zZXJ0aW9ucygrKSwgMTEgZGVsZXRp b25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC9vcmctc3JjLmVsIGIvbGlzcC9vcmctc3JjLmVsCmlu ZGV4IGMxMTBmMzIuLjYxYjgwMGYgMTAwNjQ0Ci0tLSBhL2xpc3Avb3JnLXNyYy5lbAorKysgYi9s aXNwL29yZy1zcmMuZWwKQEAgLTYwMSwxMSArNjAxLDkgQEAgdGhlIGxhbmd1YWdlLCBhIHN3aXRj aCB0ZWxsaW5nIGlmIHRoZSBjb250ZW50IHNob3VsZCBiZSBpbiBhIHNpbmdsZSBsaW5lLiIKIAkg KGJ1ZmZlciAoY3VycmVudC1idWZmZXIpKQogCSAoc2luZ2xlIChvcmctYm91bmQtYW5kLXRydWUt cCBv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iIgcykKKyAgICAoZ290by1jaGFyIChwb2ludC1taW4pKQorICAgICh3aGlsZSAocmUtc2VhcmNo LWZvcndhcmQgIl4iIG5pbCB0KQorICAgICAgKHJlcGxhY2UtbWF0Y2ggcykpKSkKKwogKGRlZnVu IG9yZy1lZGl0LXNyYy1zYXZlICgpCiAgICJTYXZlIHBhcmVudCBidWZmZXIgd2l0aCBjdXJyZW50 IHN0YXRlIHNvdXJjZS1jb2RlIGJ1ZmZlci4iCiAgIChpbnRlcmFjdGl2ZSkKLS0gCjEuNy45Cgo= --_004_21A5E1E970CD46459ECBE86D6CC4B28C674153FCspexch01WindLog_--