all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Error on `get-text-property`
@ 2021-11-28 15:07 guo.yong--- via Users list for the GNU Emacs text editor
  2021-11-28 15:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-11-28 16:46 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 6+ messages in thread
From: guo.yong--- via Users list for the GNU Emacs text editor @ 2021-11-28 15:07 UTC (permalink / raw)
  To: Help Gnu Emacs

Hello.

I'm using `smartparens-mode` and it causes an erorr when I try to delete word when the kill ring is empty.

From the backtrack, the error occured from `kill-append`. The reason is that `kill-append` calls `get-text-property` in the function. But when the kill ring is empty, the function call is `(get-text-property 0 'yank-handler nil)` which cause the error.

I don't know Elisp well so I'm at lost. Is there any workaround for this problem or do I have to report this to Emacs devs (the functions are from `simple.el`)?

Regards.Yong.

P.S. This is my first time using mailing list. Sorry for the previous mail from me (https://lists.gnu.org/archive/html/help-gnu-emacs/2021-11/msg00415.html)


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

* Re: Error on `get-text-property`
  2021-11-28 15:07 Error on `get-text-property` guo.yong--- via Users list for the GNU Emacs text editor
@ 2021-11-28 15:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-11-29  0:51   ` guo.yong--- via Users list for the GNU Emacs text editor
  2021-11-28 16:46 ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-11-28 15:19 UTC (permalink / raw)
  To: help-gnu-emacs

guo.yong--- via Users list for the GNU Emacs text editor wrote:

> From the backtrack, the error occured from `kill-append`.
> The reason is that `kill-append` calls `get-text-property`
> in the function. But when the kill ring is empty, the
> function call is `(get-text-property 0 'yank-handler nil)`
> which cause the error.

What error, this one

  eval: Args out of range: 0,0 

?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Error on `get-text-property`
  2021-11-28 15:07 Error on `get-text-property` guo.yong--- via Users list for the GNU Emacs text editor
  2021-11-28 15:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-11-28 16:46 ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-11-28 16:46 UTC (permalink / raw)
  To: help-gnu-emacs

guo.yong--- via Users list for the GNU Emacs text editor wrote:

> From the backtrack, the error occured from `kill-append`.

BTW `kill-append' is another one of these functions that end
with something that can be t or nil, from the on-line help it
says

  (kill-append STRING BEFORE-P)

  [...] If BEFORE-P is non-nil, prepend STRING to the kill
  instead

One can instead make the last argument optional, it then
defaults ot nil, instead of having ugly code that looks like
this

  (kill-append "This doesn't look good" nil)

where people have to check what that second argument nil
really is ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Error on `get-text-property`
  2021-11-28 15:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-11-29  0:51   ` guo.yong--- via Users list for the GNU Emacs text editor
  2021-11-29 10:32     ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: guo.yong--- via Users list for the GNU Emacs text editor @ 2021-11-29  0:51 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: Help Gnu Emacs

Yes. It is that error.
I think I have a workaround now. Changing the call of get-text-property in kill-append to
(get-text-property (if (null cur)
                                               1
                                             0) 'yank-handler cur)

Seems to fix the error. I'll have to try it out for a while to see how it affects other functions as well.

Regrads.
Yong.
-- 
 Sent with Tutanota, the secure & ad-free mailbox. 



Nov 28, 2021, 22:19 by help-gnu-emacs@gnu.org:

> guo.yong--- via Users list for the GNU Emacs text editor wrote:
>
>> From the backtrack, the error occured from `kill-append`.
>> The reason is that `kill-append` calls `get-text-property`
>> in the function. But when the kill ring is empty, the
>> function call is `(get-text-property 0 'yank-handler nil)`
>> which cause the error.
>>
>
> What error, this one
>
>  eval: Args out of range: 0,0 
>
> ?
>
> -- 
> underground experts united
> https://dataswamp.org/~incal
>



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

* Re: Error on `get-text-property`
  2021-11-29  0:51   ` guo.yong--- via Users list for the GNU Emacs text editor
@ 2021-11-29 10:32     ` Michael Heerdegen
  2021-11-30 15:17       ` guo.yong--- via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2021-11-29 10:32 UTC (permalink / raw)
  To: help-gnu-emacs

guo.yong--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Yes. It is that error.
> I think I have a workaround now. Changing the call of
> get-text-property in kill-append to
> (get-text-property (if (null cur)
>                                                1
>                                              0) 'yank-handler cur)
>
> Seems to fix the error.

This only masks the symptom.  `kill-append' must not be called when the
kill-ring is empty.  smartparens should take care of this.

Michael.




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

* Re: Error on `get-text-property`
  2021-11-29 10:32     ` Michael Heerdegen
@ 2021-11-30 15:17       ` guo.yong--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 6+ messages in thread
From: guo.yong--- via Users list for the GNU Emacs text editor @ 2021-11-30 15:17 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs

You are right. I found another error from get-text-property but I cannot reproduce this bug yet :/ It looks like I have to hack around smartparens for a bit. 

Yong. 
-- 
 Sent with Tutanota, the secure & ad-free mailbox. 



Nov 29, 2021, 17:32 by michael_heerdegen@web.de:

> guo.yong--- via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> writes:
>
>> Yes. It is that error.
>> I think I have a workaround now. Changing the call of
>> get-text-property in kill-append to
>> (get-text-property (if (null cur)
>>                                                1
>>                                              0) 'yank-handler cur)
>>
>> Seems to fix the error.
>>
>
> This only masks the symptom.  `kill-append' must not be called when the
> kill-ring is empty.  smartparens should take care of this.
>
> Michael.
>


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

end of thread, other threads:[~2021-11-30 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-28 15:07 Error on `get-text-property` guo.yong--- via Users list for the GNU Emacs text editor
2021-11-28 15:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-29  0:51   ` guo.yong--- via Users list for the GNU Emacs text editor
2021-11-29 10:32     ` Michael Heerdegen
2021-11-30 15:17       ` guo.yong--- via Users list for the GNU Emacs text editor
2021-11-28 16:46 ` Emanuel Berg via Users list for the GNU Emacs text editor

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.