From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] org-delete-indentation Date: Sun, 17 May 2015 10:33:29 +0200 Message-ID: <87k2w78uxy.fsf@nicolasgoaziou.fr> References: <87fv6wh6yr.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YttzS-0001cT-5y for emacs-orgmode@gnu.org; Sun, 17 May 2015 04:32:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YttzR-0007W5-BJ for emacs-orgmode@gnu.org; Sun, 17 May 2015 04:32:06 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:50539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YttzR-0007Vp-6K for emacs-orgmode@gnu.org; Sun, 17 May 2015 04:32:05 -0400 In-Reply-To: <87fv6wh6yr.fsf@gmx.us> (rasmus@gmx.us's message of "Sat, 16 May 2015 17:34:20 +0200") 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: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus writes: > Due to recent controversy about Org being lacking Microsoftesque detail I > finally implemented org-delete-indentation, which is a function I have > been missing forever. Thank you. > +(defun org-delete-indentation (&optional ARG) > + "Join this line to previous and fix up whitespace at join. > + > +If previous row is a headline add to headline text." You need to describe what ARG does. > + (interactive "*P") > + (if (save-excursion (if ARG > + (beginning-of-line) > + (forward-line -1)) > + (looking-at org-complex-heading-regexp)) > + ;; At headline. > + (let ((string (concat " " (prog2 (and ARG (forward-line 1)) > + (org-trim (delete-and-extract-region (line-beginning-position) > + (line-end-position))))))) > + (when (eq (preceding-char) ?\n) (delete-region (point) (1- (point)))) (unless (bobp) (delete-region ....)) Also, shouldn't the final (delete-indentation ARG) be in the "else" part of the `if'? > +(ert-deftest test-org-delete-indentation () > + "Test M-^ (`org-delete-indentation') specification." I suggest to omit binding in the description. That's one thing less we have to keep up-to-date if it ever changes. Regards, -- Nicolas Goaziou