Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(goto-char beg) throw error, when called from function (comment-regio… #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sharad
Copy link

@sharad sharad commented Dec 12, 2020

…n-default)

Description:
(goto-char beg) throw error "Marker points into wrong buffer", when current-buffer and marker-buffer are not same

(goto-char beg) called by comment-region
which in turn called by outshine-comment-region
whcih in turn called from adviced org-store-log-note

Reason:
Issue happens when current-buffer and marker-buffer are not same

It usually happens when (org-store-log-note) used in uninteractively
For example:
Using org-store-log-note in a idle timer to log predefined note in a org file.

  Here org-store-log-note is called through org-clock-out which is called
  from a idle timer function.

Backtrace:
Debugger entered--Lisp error: (error "Marker points into wrong buffer" #<marker at 28600 in report.org>)
comment-region-default(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org> nil)
comment-region(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org> nil)
outshine-comment-region(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org>)
ad-Advice-org-store-log-note
apply(ad-Advice-org-store-log-note
org-store-log-note()
org-ctrl-c-ctrl-c(nil)
funcall-interactively(org-ctrl-c-ctrl-c nil)
call-interactively(org-ctrl-c-ctrl-c nil nil)
command-execute(org-ctrl-c-ctrl-c)

Error:
(goto-char beg) through (error "Marker points into wrong buffer" #)
from comment-region-default calledby comment-region called by
outshine-comment-region

Solution:
This error can be fix by wrapping (outshine-comment-region ...) function call
in (with-current-buffer (marker-buffer org-log-note-marker) ...)

…n-default)

Description:
  (goto-char beg) throw error "Marker points into wrong buffer", when current-buffer and marker-buffer are not same

  (goto-char beg) called by comment-region
  which in turn called by outshine-comment-region
  whcih in turn called from adviced org-store-log-note

Reason:
  Issue happens when current-buffer and marker-buffer are not same

  It usually happens when (org-store-log-note) used in uninteractively
  For example:
      Using org-store-log-note in a idle timer to log predefined note in a org file.

      Here org-store-log-note is called through org-clock-out which is called
      from a idle timer function.

Backtrace:
  Debugger entered--Lisp error: (error "Marker points into wrong buffer" #<marker at 28600 in report.org>)
    comment-region-default(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org> nil)
    comment-region(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org> nil)
    outshine-comment-region(#<marker at 28600 in report.org> #<marker (moves after insertion) at 28600 in report.org>)
    ad-Advice-org-store-log-note
    apply(ad-Advice-org-store-log-note
    org-store-log-note()
    org-ctrl-c-ctrl-c(nil)
    funcall-interactively(org-ctrl-c-ctrl-c nil)
    call-interactively(org-ctrl-c-ctrl-c nil nil)
    command-execute(org-ctrl-c-ctrl-c)

Error:
  (goto-char beg) through (error "Marker points into wrong buffer" #<marker at POS in FILE>)
   from comment-region-default calledby comment-region called by
   outshine-comment-region

Solution:
  This error can be fix by wrapping (outshine-comment-region ...) function call
  in (with-current-buffer (marker-buffer org-log-note-marker) ...)
@alphapapa alphapapa self-assigned this Dec 13, 2020
@alphapapa alphapapa added the bug label Dec 13, 2020
@alphapapa
Copy link
Owner

Thanks.

@thblt Does this look good to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants