unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/pyim bf3626c 05/36: * pyim-common.el (pyim-flatten-list): Move from pyim.el
       [not found] ` <20210423025715.73EAE20D12@vcs0.savannah.gnu.org>
@ 2021-04-23  3:10   ` Stefan Monnier
  2021-04-23  4:44     ` tumashu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2021-04-23  3:10 UTC (permalink / raw)
  To: emacs-devel; +Cc: Feng Shu

> +(defun pyim-flatten-list (my-list)
> +  (cond
> +   ((null my-list) nil)
> +   ((atom my-list) (list my-list))
> +   (t (append (pyim-flatten-list (car my-list))
> +              (pyim-flatten-list (cdr my-list))))))

I believe this is called `flatten-tree` in Emacs-27.


        Stefan




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

* Re: [elpa] externals/pyim 09fd273 07/36: Sort pyim-common.el
       [not found] ` <20210423025715.E84AF20D12@vcs0.savannah.gnu.org>
@ 2021-04-23  3:14   ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2021-04-23  3:14 UTC (permalink / raw)
  To: emacs-devel; +Cc: Feng Shu

> +(defun pyim-exwm-enable-p ()
> +  "测试当前是否是 exwm 环境。"
> +  (string-match-p " \\*temp\\*" (buffer-name)))

I think this deserves a comment explaining why this test indicates
whether we're in exwm.  After all, ` *temp*` is the name of the buffers
used by `with-temp-buffer`, so AFAIK there can be lots and lots of
circumstances where the current buffer's name is ` *temp*`, regardless
of whether we're using exwm.


        Stefan




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

* Re: [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el
       [not found] ` <20210423025718.7AA4220D12@vcs0.savannah.gnu.org>
@ 2021-04-23  3:19   ` Stefan Monnier
  2021-04-23  4:46     ` tumashu
  2021-04-23  8:51     ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2021-04-23  3:19 UTC (permalink / raw)
  To: emacs-devel; +Cc: Feng Shu

> +  (pyim-with-entered-buffer
> +    (cond
> +     ((equal 1 (point))
> +      (buffer-string))
> +     ((eq type 'point-before)
> +      (buffer-substring-no-properties 1 (point)))

I recommend you use (point-min) rather than hardcoding 1.
It's a good practice in general, and as a bonus it leads to marginally
better bytecode.


        Stefan




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

* Re:Re: [elpa] externals/pyim bf3626c 05/36: * pyim-common.el (pyim-flatten-list): Move from pyim.el
  2021-04-23  3:10   ` [elpa] externals/pyim bf3626c 05/36: * pyim-common.el (pyim-flatten-list): Move from pyim.el Stefan Monnier
@ 2021-04-23  4:44     ` tumashu
  0 siblings, 0 replies; 6+ messages in thread
From: tumashu @ 2021-04-23  4:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

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

Fixed, thanks!





















At 2021-04-23 11:10:42, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>> +(defun pyim-flatten-list (my-list)
>> +  (cond
>> +   ((null my-list) nil)
>> +   ((atom my-list) (list my-list))
>> +   (t (append (pyim-flatten-list (car my-list))
>> +              (pyim-flatten-list (cdr my-list))))))
>
>I believe this is called `flatten-tree` in Emacs-27.
>
>
>        Stefan

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

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

* Re:Re: [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el
  2021-04-23  3:19   ` [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el Stefan Monnier
@ 2021-04-23  4:46     ` tumashu
  2021-04-23  8:51     ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: tumashu @ 2021-04-23  4:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

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

Fixed, thanks!





















At 2021-04-23 11:19:49, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>> +  (pyim-with-entered-buffer
>> +    (cond
>> +     ((equal 1 (point))
>> +      (buffer-string))
>> +     ((eq type 'point-before)
>> +      (buffer-substring-no-properties 1 (point)))
>
>I recommend you use (point-min) rather than hardcoding 1.
>It's a good practice in general, and as a bonus it leads to marginally
>better bytecode.
>
>
>        Stefan

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

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

* Re: [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el
  2021-04-23  3:19   ` [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el Stefan Monnier
  2021-04-23  4:46     ` tumashu
@ 2021-04-23  8:51     ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2021-04-23  8:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Feng Shu, emacs-devel

On Apr 22 2021, Stefan Monnier wrote:

>> +  (pyim-with-entered-buffer
>> +    (cond
>> +     ((equal 1 (point))
>> +      (buffer-string))
>> +     ((eq type 'point-before)
>> +      (buffer-substring-no-properties 1 (point)))
>
> I recommend you use (point-min) rather than hardcoding 1.
> It's a good practice in general, and as a bonus it leads to marginally
> better bytecode.

Also, (equal 1 (point)) should be written as (bobp).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



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

end of thread, other threads:[~2021-04-23  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210423025712.4844.13627@vcs0.savannah.gnu.org>
     [not found] ` <20210423025715.73EAE20D12@vcs0.savannah.gnu.org>
2021-04-23  3:10   ` [elpa] externals/pyim bf3626c 05/36: * pyim-common.el (pyim-flatten-list): Move from pyim.el Stefan Monnier
2021-04-23  4:44     ` tumashu
     [not found] ` <20210423025715.E84AF20D12@vcs0.savannah.gnu.org>
2021-04-23  3:14   ` [elpa] externals/pyim 09fd273 07/36: Sort pyim-common.el Stefan Monnier
     [not found] ` <20210423025718.7AA4220D12@vcs0.savannah.gnu.org>
2021-04-23  3:19   ` [elpa] externals/pyim 9f017ac 18/36: New file: pyim-entered.el Stefan Monnier
2021-04-23  4:46     ` tumashu
2021-04-23  8:51     ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).