New answers tagged

2

Before you say "thing-at-point" - I cannot install it (work network). thing-at-point has been built into Emacs since 1993. thing-at-point is an autoloaded compiled Lisp function in ‘thingatpt.el’. (thing-at-point THING &optional NO-PROPERTIES) Probably introduced at or before Emacs version 20. Return the THING at point. THING should be a ...


2

You can try the following command. It has certainly lots of corner cases as it uses a simple whitespace syntax. If your intention is to copy arbitrary text, it's easier to select the region C-SPC (set-mark-command), then copy it M-w (kill-ring-save). (defun my-string-at-point () "Save the space-delimited string at point to the kill ring." (...


1

This "answer" is not meant to be an the answer to the question because it is not "using cl-loop". But rather provide an alternative (as many other answers have done already). I would recommend using loopy. According to its readme, Loopy is an (external) emacs package that provides a "a macro meant for iterating and looping [that is] ...


0

This doesn't answer your question about CL's loop. But it shows you another, simple way to do what you apparently want to do. (let ((result ()) file-name attributes mtime size) (dolist (prefix mylist) (unless (stringp prefix) (setq file-name (concat prefix ".txt") attributes (file-attributes file-name) ...


0

If you are looking for short-circuiting logic, e.g. nothing proceeds after one condition fails, I think you need to use something like the and macro. I don't know a way to do this other than to let bind some variables, and use setq inside the loop like below. The attributes line will only be set when the file-name exists here. #+BEGIN_SRC emacs-lisp (...


3

Well, you could define it this way: (defun my-shrink () (interactive) (dotimes (_ 43) (shrink-window-horizontally 1))) But that's not quite as elegant as this: (defun my-shrink () (interactive) (shrink-window-horizontally 43)) And since that's so short, maybe you don't even need to define anything at all. Just call (shrink-window-horizontally ...


Top 50 recent answers are included