emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Miguel Garza" <miguelgarza@fastmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] Killing link located at beginning of line does not kill full link if region is selected to beginning or end of line by either mouse or arrow keys [9.5.2 (release_9.5.2-13-gdd6486 @ c:/Program Files/Emacs/emacs-29.0.50-snapshot/share/emacs/29.0.50/lisp/org/)]
Date: Mon, 10 Apr 2023 21:23:57 -0500	[thread overview]
Message-ID: <4277d947-36de-45fd-b161-c8e4af5d17eb@app.fastmail.com> (raw)

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

Hello,

I have Emacs 28 on one machine and this build 29 on this machine--both running on Windows 10. I've encountered the same bug on both builds of Emacs. I believe it's a bug.

To reproduce the behavior, first make a link that begins a line, such as:

[[www.google.com][link]]

Org Mode will turn the above text into a clickable link called "link".

Now, select the link either by clicking and dragging the mouse from the end of the word "link" to the beginning of the word, or by starting a region at either the beginning or end of the word (or on the next line) and then using the arrow keys to move point to either the "l" or "k" in "link".

Your region should now encompass "link" and nothing else.

Now, kill the line or region.

You will see immediately that the full text was not killed. Instead, the link description is killed, along with, depending on where point was, possibly some of the brackets, leaving behind the opening brackets, the link URL, the URL closing bracket, and in some cases the final two brackets.

This behavior does not occur if the link is not at the beginning of a line. For example, write this instead:

This is a [[www.google.com][link]] to Google.

Now, mark the same area, just the link that Org Mode has made, called "link", using the mouse or using a region demarcated by using the arrow keys.

Now, kill the link.

You will see that the full link has been killed. Yank to confirm.

I believe org mode is not correctly finding the last characters to select before either the beginning or end of the line in these use cases.

Thank you!

Emacs  : GNU Emacs 29.0.50 (build 8, x86_64-w64-mingw32)
of 2022-02-11
Package: Org mode version 9.5.2 (release_9.5.2-13-gdd6486 @ c:/Program Files/Emacs/emacs-29.0.50-snapshot/share/emacs/29.0.50/lisp/org/)

current state:
==============
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-bibtex-headline-format-function #[257 "\300\x01\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-export-before-parsing-hook '(org-attach-expand-links)
org-archive-hook '(org-attach-archive-delete-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append local]
   5]
#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
    append local]
   5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-confirm-shell-link-function 'yes-or-no-p
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
     org-src-mode-configure-edit-buffer)
org-confirm-elisp-link-function 'yes-or-no-p
org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
      org-babel-header-arg-expand)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
       ("id" :follow org-id-open)
       ("eww" :follow org-eww-open :store org-eww-store-link)
       ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
       ("irc" :follow org-irc-visit :store org-irc-store-link
:export org-irc-export)
       ("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
       ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
       ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
       ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
       ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
       ("w3m" :store org-w3m-store-link)
       ("doi" :follow org-link-doi-open :export
org-link-doi-export)
       ("file+sys") ("file+emacs")
       ("shell" :follow org-link--open-shell)
       ("news" :follow
#[514 "\301\300\302\x04Q\x02\"\207"
  ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
       ("mailto" :follow
#[514 "\301\300\302\x04Q\x02\"\207"
  ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
       ("https" :follow
#[514 "\301\300\302\x04Q\x02\"\207"
  ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
       ("http" :follow
#[514 "\301\300\302\x04Q\x02\"\207"
  ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
       ("ftp" :follow
#[514 "\301\300\302\x04Q\x02\"\207" ["ftp" browse-url ":"]
  6 "\n\n(fn URL ARG)"]
)
       ("help" :follow org-link--open-help :store
org-link--store-help)
       ("file" :complete org-link-complete-file)
       ("elisp" :follow org-link--open-elisp))
org-metaup-hook '(org-babel-load-in-session-maybe)
)

[-- Attachment #2: Type: text/html, Size: 7746 bytes --]

             reply	other threads:[~2023-04-11 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  2:23 Miguel Garza [this message]
2023-04-12  8:53 ` [BUG] Killing link located at beginning of line does not kill full link if region is selected to beginning or end of line by either mouse or arrow keys [9.5.2 (release_9.5.2-13-gdd6486 @ c:/Program Files/Emacs/emacs-29.0.50-snapshot/share/emacs/29.0.50/lisp/org/)] Ihor Radchenko
2023-04-13  2:51   ` Miguel Garza
2023-04-13 10:49     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4277d947-36de-45fd-b161-c8e4af5d17eb@app.fastmail.com \
    --to=miguelgarza@fastmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).