all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)]
@ 2023-04-14 14:38 Spencer Baugh
  2023-04-15 14:41 ` Emacs and org mode in aws Naresh Gurbuxani
  2023-04-16 11:07 ` [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Ihor Radchenko
  0 siblings, 2 replies; 8+ messages in thread
From: Spencer Baugh @ 2023-04-14 14:38 UTC (permalink / raw)
  To: emacs-orgmode


1. emacs -Q
2. Insert the following in an org-mode buffer
* head
a
b
3. C-x h M-^ and note that it's now formatted as:
a
b
 * head
4. Undo, then M-> C-SPC M-< C-n M-^ and note that it's now formatted as:
* head a
b
5. Undo, then M-< C-SPC M-> M-^ and note that it's now formatted
(correctly) as:
* head a b

The 3rd and 4th steps are wrong, or at least inconsistent with how
normal delete-indentation works on a region.  In 4, I assume the issue
is that org-delete-indentation doesn't check to see if a region is
active before using its special logic.  No idea what's up with 3.

Emacs  : GNU Emacs 29.0.60 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars)
 of 2023-03-13
Package: Org mode version 9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Emacs and org mode in aws
  2023-04-14 14:38 [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Spencer Baugh
@ 2023-04-15 14:41 ` Naresh Gurbuxani
  2023-04-16 11:04   ` Ihor Radchenko
  2023-04-17  3:43   ` Christopher M. Miles
  2023-04-16 11:07 ` [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Ihor Radchenko
  1 sibling, 2 replies; 8+ messages in thread
From: Naresh Gurbuxani @ 2023-04-15 14:41 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

In my Amazon Web Service account, I can launch emacs from the terminal.  Nearly all emacs features work well.  But I miss the ability to view graphs created by code blocks in org mode.  Have other members found a solution?

Thanks,
Naresh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs and org mode in aws
  2023-04-15 14:41 ` Emacs and org mode in aws Naresh Gurbuxani
@ 2023-04-16 11:04   ` Ihor Radchenko
  2023-04-16 15:44     ` Naresh Gurbuxani
  2023-04-17  3:43   ` Christopher M. Miles
  1 sibling, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-04-16 11:04 UTC (permalink / raw)
  To: Naresh Gurbuxani; +Cc: emacs-orgmode@gnu.org

Naresh Gurbuxani <naresh_gurbuxani@hotmail.com> writes:

> In my Amazon Web Service account, I can launch emacs from the terminal.  Nearly all emacs features work well.  But I miss the ability to view graphs created by code blocks in org mode.  Have other members found a solution?

If your terminal Emacs does not support graphics, images will not be displayed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)]
  2023-04-14 14:38 [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Spencer Baugh
  2023-04-15 14:41 ` Emacs and org mode in aws Naresh Gurbuxani
@ 2023-04-16 11:07 ` Ihor Radchenko
  2023-04-30 15:05   ` Ihor Radchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-04-16 11:07 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

Spencer Baugh <sbaugh@janestreet.com> writes:

> 1. emacs -Q
> 2. Insert the following in an org-mode buffer
> * head
> a
> b
> 3. C-x h M-^ and note that it's now formatted as:
> a
> b
>  * head

`org-delete-indentation' did not support regions properly.
I tried to make things more consistent with `delete-indentation in the
attached patch.

May you please test the patch and let me know if there are any other
inconsistencies you observe?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-delete-indentation-Support-region-selection.patch --]
[-- Type: text/x-patch, Size: 3543 bytes --]

From 6e9a09dd74e0fcb38563b1042163e95e3e43c4da Mon Sep 17 00:00:00 2001
Message-Id: <6e9a09dd74e0fcb38563b1042163e95e3e43c4da.1681642978.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sun, 16 Apr 2023 13:00:40 +0200
Subject: [PATCH] org-delete-indentation: Support region selection

* lisp/org.el (org-delete-indentation): Support active region when the
first line in region is a heading.  Clarify in the docstring that
region is ignored with prefix argument.

Reported-by: Spencer Baugh <sbaugh@janestreet.com>
Link: https://orgmode.org/list/ier3552edfr.fsf@janestreet.com
---
 lisp/org.el | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 26d2a8610..9422fd587 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17675,41 +17675,50 @@ (defun org-kill-note-or-show-branches ()
 	   (org-fold-show-branches)
 	   (org-fold-hide-archived-subtrees beg end)))))
 
-(defun org-delete-indentation (&optional arg)
+(defun org-delete-indentation (&optional arg beg end)
   "Join current line to previous and fix whitespace at join.
 
 If previous line is a headline add to headline title.  Otherwise
 the function calls `delete-indentation'.
 
-I.e. with a non-nil optional argument, join the line with the
-following one.  If there is a region then join the lines in that
-region."
-  (interactive "*P")
+If there is a region (BEG END), then join the lines in that region.
+
+With a non-nil prefix ARG, join the line with the following one,
+ignoring region."
+  (interactive
+   (cons current-prefix-arg
+         (when (and (not current-prefix-arg) (use-region-p))
+           (list (region-beginning) (region-end)))))
+  (unless (and beg end)
+    ;; No region selected or BEG/END arguments not passed.
+    (setq beg (line-beginning-position (if arg 1 0))
+          end (line-end-position (if arg 2 1))))
   (if (save-excursion
-	(beginning-of-line (if arg 1 0))
-	(let ((case-fold-search nil))
-	  (looking-at org-complex-heading-regexp)))
+        (goto-char beg)
+        (beginning-of-line)
+        (and (< (line-end-position) end)
+             (let ((case-fold-search nil))
+	       (looking-at org-complex-heading-regexp))))
       ;; At headline.
       (let ((tags-column (when (match-beginning 5)
 			   (save-excursion (goto-char (match-beginning 5))
 					   (current-column))))
-	    (string (concat " " (progn (when arg (forward-line 1))
-				       (org-trim (delete-and-extract-region
-						  (line-beginning-position)
-						  (line-end-position)))))))
-	(unless (bobp) (delete-region (point) (1- (point))))
+	    string)
+        (goto-char beg)
+        ;; Join all but headline.
+        (save-excursion (save-match-data (delete-indentation nil (line-beginning-position 2) end)))
+        (setq string (org-trim (delete-and-extract-region (line-end-position) (line-end-position 2))))
 	(goto-char (or (match-end 4)
 		       (match-beginning 5)
 		       (match-end 0)))
 	(skip-chars-backward " \t")
-	(save-excursion (insert string))
+	(save-excursion (insert " " string))
 	;; Adjust alignment of tags.
 	(cond
 	 ((not tags-column))		;no tags
 	 (org-auto-align-tags (org-align-tags))
 	 (t (org--align-tags-here tags-column)))) ;preserve tags column
-    (let ((current-prefix-arg arg))
-      (call-interactively #'delete-indentation))))
+    (funcall-interactively #'delete-indentation arg beg end)))
 
 (defun org-open-line (n)
   "Insert a new row in tables, call `open-line' elsewhere.
-- 
2.40.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Emacs and org mode in aws
  2023-04-16 11:04   ` Ihor Radchenko
@ 2023-04-16 15:44     ` Naresh Gurbuxani
  2023-04-16 15:59       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Naresh Gurbuxani @ 2023-04-16 15:44 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org

I understand that, in terminal, images are not displayed in emacs.  Are people using other ways to connect to aws where they can see images in emacs?

Sent from my iPhone

> On Apr 16, 2023, at 7:01 AM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> Naresh Gurbuxani <naresh_gurbuxani@hotmail.com> writes:
> 
>> In my Amazon Web Service account, I can launch emacs from the terminal.  Nearly all emacs features work well.  But I miss the ability to view graphs created by code blocks in org mode.  Have other members found a solution?
> 
> If your terminal Emacs does not support graphics, images will not be displayed.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs and org mode in aws
  2023-04-16 15:44     ` Naresh Gurbuxani
@ 2023-04-16 15:59       ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-04-16 15:59 UTC (permalink / raw)
  To: Naresh Gurbuxani; +Cc: emacs-orgmode@gnu.org

Naresh Gurbuxani <naresh_gurbuxani@hotmail.com> writes:

> I understand that, in terminal, images are not displayed in emacs.  Are people using other ways to connect to aws where they can see images in emacs?

I don't, but you may look into 40.1 TCP Emacs server (Emacs manual)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs and org mode in aws
  2023-04-15 14:41 ` Emacs and org mode in aws Naresh Gurbuxani
  2023-04-16 11:04   ` Ihor Radchenko
@ 2023-04-17  3:43   ` Christopher M. Miles
  1 sibling, 0 replies; 8+ messages in thread
From: Christopher M. Miles @ 2023-04-17  3:43 UTC (permalink / raw)
  To: Naresh Gurbuxani; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]


Naresh Gurbuxani <naresh_gurbuxani@hotmail.com> writes:

> In my Amazon Web Service account, I can launch emacs from the terminal. Nearly all emacs features
> work well. But I miss the ability to view graphs created by code blocks in org mode. Have other
> members found a solution?
>

I don't know whether AWS supports SSH X11 Forwarding. But you can check
out this feature to get Linux desktop forwarding view as for Emacs
graphics.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)]
  2023-04-16 11:07 ` [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Ihor Radchenko
@ 2023-04-30 15:05   ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-04-30 15:05 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> `org-delete-indentation' did not support regions properly.
> I tried to make things more consistent with `delete-indentation in the
> attached patch.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=09cf89f71

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-30 15:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-14 14:38 [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Spencer Baugh
2023-04-15 14:41 ` Emacs and org mode in aws Naresh Gurbuxani
2023-04-16 11:04   ` Ihor Radchenko
2023-04-16 15:44     ` Naresh Gurbuxani
2023-04-16 15:59       ` Ihor Radchenko
2023-04-17  3:43   ` Christopher M. Miles
2023-04-16 11:07 ` [BUG] org-delete-indentation on region doesn't work when END is before BEGIN [9.6.1 (release_9.6.1-40-g3d817c @ /home/sbaugh/.local/src/emacs29/lisp/org/)] Ihor Radchenko
2023-04-30 15:05   ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.