From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SOSsMLa+OmU4/AAAG6o9tA:P1 (envelope-from ) for ; Thu, 26 Oct 2023 21:32:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id SOSsMLa+OmU4/AAAG6o9tA (envelope-from ) for ; Thu, 26 Oct 2023 21:32:06 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 75730389F7 for ; Thu, 26 Oct 2023 21:32:06 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=vodafonemail.de header.s=vfde-mb-mr2-23sep header.b=Q64dowMT; dmarc=pass (policy=quarantine) header.from=vodafonemail.de; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698348726; a=rsa-sha256; cv=none; b=IsPBhVEspKRapZ89cHLG+wdLOTPP2B2Ziu/OssMjnWeear+2LF5FruxneWmyn5IcJygKtY c9mCs6RYqeQvTQF7eyOJXF/6H0XMj+QfQ6SdEIIaKxARkqTb4XAWaa50I1YOG7c4vPuiLa EfUdIBm7xkULCGbDpogr5Maw8uIh8CCJjvp/qdtE2l0fWmvqcUi1u46GAgooWMeZEBLR7+ 1rCXh0u0quTlQo9Kr0mrCVNyUrvzGll4MsxiOB+Z1sN1PEXiM5kGG4jaka+9AIM5YvlWJp 3irIbPPh4nKSvAzrqOCn6YisR4a9wKodsa5ZvmpjDkHaFci77mGvEyBf09ey6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698348726; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=AVGZfjJ7mzjzQY4xQqHAfkjbqA8cLBxVDTvolxBdQDY=; b=Sq0gx05lR682+y9GYAgnqSulNq12LY4JzHbAurPpsikIriIgKjJ/fZBd9n3nksoCZTbcQP ReBx5L/vZh4UGedVsrttQS2/eg/WyiNwuOriBFSqgjohX/MElD5gnvm/0tvnUOoE2Amej2 mbW/77j87iIBqRXf58Wu1KmKYXD7L2kKHtBf7a4cYDThqwkeCWUcdfEGMkPUahrvWF+OZL KHN7ThZFFraK4DSmkV7Xm5D5hrKhWnDDwIud+IaTcV7Kl0J/uxe5cqFVTkP+IRscIIqNuW pkLnSeQKzTL97PlSyT6YkHG84PoRAomDxCinBtNe/+SXPXwx9dcDGkgOdL1O8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=vodafonemail.de header.s=vfde-mb-mr2-23sep header.b=Q64dowMT; dmarc=pass (policy=quarantine) header.from=vodafonemail.de; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw64X-0003Lg-5v; Thu, 26 Oct 2023 15:31:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qw64T-0003LF-RP for emacs-orgmode@gnu.org; Thu, 26 Oct 2023 15:31:10 -0400 Received: from mr4.vodafonemail.de ([145.253.228.164]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qw64P-0003LE-QV for emacs-orgmode@gnu.org; Thu, 26 Oct 2023 15:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1698348651; bh=AVGZfjJ7mzjzQY4xQqHAfkjbqA8cLBxVDTvolxBdQDY=; h=Message-ID:Date:User-Agent:From:Content-Language:To:Subject: Content-Type:From; b=Q64dowMTnJMqUok5KjzTwwsWQF+Ycco2d2yg8z8f2nEXlu6iW2w9eWjA73575jWKB MCA/ltLH/2HbCA/toLflIEZM849wb/RrFyRDu+3SuMTAJFlaqLk3T5mZ/ViAkl+jcF +IUFkggk16KGaguJYEEN8MRYi09pjWsOl5Z1769I= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr4.vodafonemail.de (Postfix) with ESMTPS id 4SGbVz1vXFz1y3b for ; Thu, 26 Oct 2023 19:30:51 +0000 (UTC) Received: from [192.168.178.41] (port-92-194-236-211.dynamic.as20676.net [92.194.236.211]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4SGbVt6QjwzHpxb for ; Thu, 26 Oct 2023 19:30:43 +0000 (UTC) Message-ID: Date: Thu, 26 Oct 2023 21:30:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jens Schmidt Content-Language: de-DE-frami, en-US To: Org-mode Subject: [BUG] org-comment-dwim does not work with temporary Transient Mark mode [9.7-pre (release_9.6.10-902-g41ff56 @ /home/jschmidt/work/org-mode/lisp/)] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-type: clean X-purgate: clean X-purgate-size: 2343 X-purgate-ID: 155817::1698348647-A2FF818D-CEA047E6/0/0 Received-SPF: pass client-ip=145.253.228.164; envelope-from=jschmidt4gnu@vodafonemail.de; helo=mr4.vodafonemail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -9.52 X-Migadu-Queue-Id: 75730389F7 X-Migadu-Spam-Score: -9.52 X-TUID: 9f+P13F7FS5S * Reproducer Save the following files: ------------------------- /tmp/test.org ------------------------- #+begin_src bash foo bar baz #+end_src ------------------------- /tmp/test.org ------------------------- ------------------------- /tmp/test.el ------------------------- (transient-mark-mode -1) (setq org-support-shift-select t) ------------------------- /tmp/test.el ------------------------- Then start Emacs as emacs -Q -l /tmp/test.el +2 /tmp/test.org Select the three lines of the source block with `C-3 S-', then press `M-;'. For me the resulting buffer looks like: ------------------------- /tmp/test.org ------------------------- #+begin_src bash foo bar baz # (point) #+end_src ------------------------- /tmp/test.org ------------------------- where I would have expected: ------------------------- /tmp/test.org ------------------------- #+begin_src bash # foo # bar # baz(point) #+end_src ------------------------- /tmp/test.org ------------------------- The latter result you get when Transient Mark mode is permanently on. * My Educated Guess In the following snippet from `org-comment-dwim' (org-babel-do-in-edit-buffer (call-interactively #'comment-dwim))) the buffer-local setting of `transient-mark-mode' (having value `(only)' when a region is shift-selected) from buffer test.org does not get transferred to the intermediate source buffer. However, function `comment-dwim' relies on that to decide whether to operate on point or on region: comment-dwim is an interactive native-compiled Lisp function in ‘newcomment.el’. Call the comment command you want (Do What I Mean). If the region is active and ‘transient-mark-mode’ is on, call ‘comment-region’ (unless it only consists of comments, in which case it calls ‘uncomment-region’); [...] So probably somewhere in `org-babel-do-in-edit-buffer' the value of `transient-mark-mode', if it is buffer-local and differs from the default value, should be transferred to the intermediate source buffer. Emacs : GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2023-10-26 Package: Org mode version 9.7-pre (release_9.6.10-902-g41ff56 @ /home/jschmidt/work/org-mode/lisp/)