unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* complicated code to do trivial (?) thing
@ 2019-06-11 23:50 Emanuel Berg via help-gnu-emacs
  2019-06-12  7:16 ` Anders Dalskov
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg via help-gnu-emacs @ 2019-06-11 23:50 UTC (permalink / raw)
  To: help-gnu-emacs

Why isn't this easy to do?

Or is it?

;;; -*- lexical-binding: t -*-

;; This file: http://user.it.uu.se/~embe8573/emacs-init/abc.el
;;            https://dataswamp.org/~incal/emacs-init/abc.el

(require 'cl-lib)

(defun alphabet (&optional as-list)
  (let ((abc "a b c d e f g h i j k l m n o p q r s t u v w x y z"))
    (if as-list
        (cl-remove ?\  (string-to-list abc))
      abc
      )))
;; (alphabet t) ; (97 98 99 100 101 102 103 104 105 106 107 ...)
;; (alphabet)   ; "a b c d e f g h i j k ..."

(defun echo-alphabet (&optional number)
  (interactive "P")
  (let*((num        (or number (length (alphabet t))))
        (part       (cl-subseq (alphabet t) 0 num))
        (str-list   (cl-mapcar (lambda (c) (char-to-string c)) part))
        (str-almost (format "%s" str-list))
        (str        (substring str-almost 1 (1- (length str-almost))))
        )
    (message str) ))
;; (echo-alphabet)     ; "a b c ... x y z"
;; (echo-alphabet  10) ; "a b c d e f g h i j"
;; (echo-alphabet -10) ; "a b c d e f g h i j k l m n o p"
;; (call-interactively #'echo-alphabet)
(defalias 'abc #'echo-alphabet)

(provide 'abc)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: complicated code to do trivial (?) thing
@ 2019-07-10 17:34 Joe Trivers via help-gnu-emacs
  2019-07-10 18:10 ` Joe Trivers via help-gnu-emacs
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Trivers via help-gnu-emacs @ 2019-07-10 17:34 UTC (permalink / raw)
  To: anderspkd, moasenwood; +Cc: help-gnu-emacs

> From: help-gnu-emacs On Behalf Of Anders Dalskov
> Sent: 10 July, 2019 4:12 AM

> Emacs sometimes inserts an ellipsis if the result is longer than some
> threshold (what that threshold is, I don't know).

> Though this only happens with s-expressions, not strings, afaict.

Are you referring to the last sentence of:

Lisp Interaction mode defined in 'elisp-mode.el':
Major mode for typing and evaluating Lisp forms.
Like Lisp mode except that C-j evals the Lisp expression
before point, and prints its value into the buffer, advancing point.
Note that printing is controlled by 'eval-expression-print-length'
and 'eval-expression-print-level'.

(from C-h m in the *scratch* buffer)?

>> but sometimes both examples (see the file)
>> produces abbreviated messages, actually the
>> same one:
>>
>>     a b c d e f g h i j k l ...
>>
>> [1] https://dataswamp.org/~incal/emacs-init/abc.el

I get "ERR_CONNECTION_RESET" when I click on that file URL.

The content of this message is APPLIED MATERIALS CONFIDENTIAL. If you are not the intended recipient, please notify me, delete this email and do not use or distribute this email.



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

end of thread, other threads:[~2019-07-10 18:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-11 23:50 complicated code to do trivial (?) thing Emanuel Berg via help-gnu-emacs
2019-06-12  7:16 ` Anders Dalskov
2019-06-14 19:41   ` Emanuel Berg via help-gnu-emacs
2019-07-10  0:08   ` Emanuel Berg via help-gnu-emacs
2019-07-10  8:11     ` Anders Dalskov
2019-07-10  8:59       ` Emanuel Berg via help-gnu-emacs
2019-07-10  9:34         ` tomas
  -- strict thread matches above, loose matches on Subject: below --
2019-07-10 17:34 Joe Trivers via help-gnu-emacs
2019-07-10 18:10 ` Joe Trivers via help-gnu-emacs

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).