From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: New feature? Remove duplicate subheadings, preserving order Date: Mon, 01 Jan 2018 22:07:47 -0600 Message-ID: <87mv1wvr70.fsf@alphapapa.net> References: <87a7xxx5c5.fsf@nicolasgoaziou.fr> <87tvw5cu5t.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWDs3-00031D-IW for emacs-orgmode@gnu.org; Mon, 01 Jan 2018 23:08:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWDry-0000Ls-KA for emacs-orgmode@gnu.org; Mon, 01 Jan 2018 23:08:11 -0500 Received: from [195.159.176.226] (port=34108 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWDry-0000Ij-DA for emacs-orgmode@gnu.org; Mon, 01 Jan 2018 23:08:06 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eWDpr-0001Al-44 for emacs-orgmode@gnu.org; Tue, 02 Jan 2018 05:05:55 +0100 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" To: emacs-orgmode@gnu.org Allen Li writes: > I don’t know if a more intelligent way of handling tags and todo > keywords is worth the extra complexity, but in the use case that I > imagine it makes sense to match using only the heading/list item: > > * Things to buy > ** TODO cabbage > ** DONE milk :store1: > Maybe I forgot a tag here. Oh well, I already bought the milk. > ** TODO carrots > ** TODO milk :store1:store2: > > ... > > It doesn’t make sense to include the contents because I see this as > primarily being useful for list items. In particular, we would want > to ignore log entries and properties for the sake of matching > (intelligent property or logbook merging might be useful, but adds > complexity). I think such a command should check all heading data by default, because that's the safest option. A user who commonly needs to ignore one or more types of data could use a custom function that calls the command with arguments to disable checking of certain types. > Since the point would be remove duplicates from lists, I don’t think > warning is very useful. I would want to remove the duplicate list > items, not get a warning about it and delete them manually. Perhaps > that would be a useful additional feature however (like uniq -d). I think warning or asking for confirmation should be the default action, because it's the safest option. Users who want to skip that could use a prefix argument or call it from a custom command. > I don’t think doing a full text check is useful, but if someone has a > use case for that, please speak up. An example where this would be useful is if the user has copied and pasted subtrees and accidentally pasted one more than once. I argue here for the safest behavior by default because I've found that, in very large Org buffers, it's easy to lose my place in the file, and it's easy to accidentally do something that I didn't mean to, without noticing. IMO this is simply a consequence of Org buffers still being plain-text. So it is quite conceivable to me that a user might intentionally give two headings the same name (e.g. a user who captures quotations to an inbox file might have two "Quote" headings that are completely different), or might accidentally duplicate a subtree and then make a desired change to one of them without realizing there was a duplicate--then he might use this deduplication command and accidentally delete a subtree he didn't mean to, resulting in data loss.