unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49647: 27.2; Reference Manual sec. 10.2.4; Incorrect example for indirect-function
@ 2021-07-19 18:38 Scott Marks
  2021-07-19 23:59 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Marks @ 2021-07-19 18:38 UTC (permalink / raw)
  To: 49647

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

If one copies the example:


Here is how you could define indirect-function in Lisp:


(defun indirect-function (function)

  (if (symbolp function)

      (indirect-function (symbol-function function))

    function))


this code will throw due to infinite recursion when invoked as


(indirect-function nil)


The fix is obvious: wrap (symbolp function) with (and function ...)


I don't think this would distract from the point of the example.


Hope this helps

Scott


In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
Version 10.14.6 (Build 18G95))

 of 2021-03-27 built on builder10-14.porkrind.org

Windowing system distributor 'Apple', version 10.3.2022

System Description:  macOS 11.4


Recent messages:

Quit

Mark set

Quit

<nil> <down-mouse-1> is undefined

<nil> <mouse-1> is undefined

kill-region: Text is read-only: #<buffer *ielm*> [2 times]

<nil> <down-mouse-1> is undefined

<nil> <mouse-1> is undefined

Quit [4 times]

Configured using:

 'configure --with-ns '--enable-locallisppath=/Library/Application

 Support/Emacs/${version}/site-lisp:/Library/Application

 Support/Emacs/site-lisp' --with-modules'


Configured features:

NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

THREADS JSON PDUMPER GMP


Important settings:

  value of $LANG: en_US.UTF-8

  locale-coding-system: utf-8-unix


Major mode: IELM


Minor modes in effect:

  override-global-mode: t

  global-git-commit-mode: t

  magit-auto-revert-mode: t

  shell-dirtrack-mode: t

  gcmh-mode: t

  straight-use-package-mode: t

  straight-package-neutering-mode: t

  desktop-save-mode: t

  tooltip-mode: t

  global-eldoc-mode: t

  eldoc-mode: t

  electric-indent-mode: t

  mouse-wheel-mode: t

  tool-bar-mode: t

  menu-bar-mode: t

  file-name-shadow-mode: t

  global-font-lock-mode: t

  font-lock-mode: t

  blink-cursor-mode: t

  auto-composition-mode: t

  auto-encryption-mode: t

  auto-compression-mode: t

  line-number-mode: t

  transient-mark-mode: t


Load-path shadows:

/Users/scott/.emacs.d/straight/build/let-alist/let-alist hides
/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/let-alist


Features:

(shadow sort mail-extr emacsbug sendmail misearch multi-isearch cl-print

ielm pp etags fileloop generator xref project dired-aux sh-script smie

executable jka-compr vc-git my-haskell-elisp-autoloads

use-package-bind-key bind-key hindent-autoloads hlint-refactor-autoloads

flycheck-haskell-autoloads dante-autoloads lcr-autoloads

company-autoloads haskell-mode-autoloads attrap flycheck find-func s

attrap-autoloads flycheck-autoloads let-alist-autoloads

pkg-info-autoloads epl-autoloads f-autoloads s-autoloads magit-gitflow

magit-popup magit-gitflow-autoloads magit-popup-autoloads

magit-submodule magit-obsolete magit-blame magit-stash magit-reflog

magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote

magit-commit magit-sequence magit-notes magit-worktree magit-tag

magit-merge magit-branch magit-reset magit-files magit-refs magit-status

magit package browse-url url-handlers magit-repos magit-apply magit-wip

magit-log which-func imenu magit-diff smerge-mode diff diff-mode

git-commit rx log-edit message rfc822 mml mml-sec epa derived epg

epg-config gnus-util rmail rmail-loaddefs text-property-search mm-decode

mm-bodies mm-encode mailabbrev gmm-utils mailheader pcvs-util add-log

magit-core magit-autorevert autorevert filenotify magit-margin

magit-transient magit-process with-editor server magit-mode transient

magit-git magit-section magit-utils crm dash magit-autoloads

magit-section-autoloads git-commit-autoloads with-editor-autoloads

transient-autoloads pandoc-mode-autoloads dash-autoloads hydra-autoloads

lv-autoloads markdown-mode-autoloads dirtrack native-complete

native-complete-autoloads dired dired-loaddefs edmacro kmacro

exec-path-from-shell exec-path-from-shell-autoloads ffap tramp

tramp-loaddefs trampver tramp-integration files-x tramp-compat shell

pcomplete comint ansi-color ring parse-time iso8601 time-date ls-lisp

format-spec finder-inf gcmh gcmh-autoloads cl-extra use-package-core

use-package-autoloads bind-key-autoloads straight-autoloads straight

info autoload radix-tree easy-mmode pcase checkdoc lisp-mnt thingatpt

help-mode easymenu mail-utils gnutls network-stream url-http mail-parse

rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc

puny url-cache url-auth url url-proxy url-privacy url-expand url-methods

url-history url-cookie url-domsuf url-util url-parse auth-source cl-seq

eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map

seq byte-opt gv bytecomp byte-compile cconv url-vars mailcap

deeper-blue-theme desktop frameset cl-loaddefs cl-lib cus-start cus-load

tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type

mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win

tool-bar dnd fontset image regexp-opt fringe tabulated-list replace

newcomment text-mode elisp-mode lisp-mode prog-mode register page

tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse

jit-lock font-lock syntax facemenu font-core term/tty-colors frame

minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese

tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek

romanian slovak czech european ethiopic indian cyrillic chinese

composite charscript charprop case-table epa-hook jka-cmpr-hook help

simple abbrev obarray cl-preloaded nadvice loaddefs button faces

cus-face macroexp files text-properties overlay sha1 md5 base64 format

env code-pages mule custom widget hashtable-print-readable backquote

threads kqueue cocoa ns multi-tty make-network-process emacs)


Memory information:

((conses 16 210890 189150)

 (symbols 48 21515 1)

 (strings 32 69271 38020)

 (string-bytes 1 2340771)

 (vectors 16 38156)

 (vector-slots 8 828157 241244)

 (floats 8 125 1238)

 (intervals 56 2074 118)

 (buffers 1000 30))

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

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

* bug#49647: 27.2; Reference Manual sec. 10.2.4; Incorrect example for indirect-function
  2021-07-19 18:38 bug#49647: 27.2; Reference Manual sec. 10.2.4; Incorrect example for indirect-function Scott Marks
@ 2021-07-19 23:59 ` Michael Heerdegen
  2021-07-20 12:06   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2021-07-19 23:59 UTC (permalink / raw)
  To: Scott Marks; +Cc: 49647

Scott Marks <scott.c.marks@gmail.com> writes:

> If one copies the example:

You mean from the manual, (info "(elisp) Function Indirection") I think.

>  Here is how you could define indirect-function in Lisp:
>
>  (defun indirect-function (function)
>
>    (if (symbolp function)
>
>        (indirect-function (symbol-function function))
>
>      function))
>
> this code will throw due to infinite recursion when invoked as
>
> (indirect-function nil)
>
> The fix is obvious: wrap (symbolp function) with (and function ...)

In my opinion your analysis is correct and the fix is good.

I leave it to the second reader to make the change.


Michael.





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

* bug#49647: 27.2; Reference Manual sec. 10.2.4; Incorrect example for indirect-function
  2021-07-19 23:59 ` Michael Heerdegen
@ 2021-07-20 12:06   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-20 12:06 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Scott Marks, 49647

Michael Heerdegen <michael_heerdegen@web.de> writes:

> In my opinion your analysis is correct and the fix is good.
>
> I leave it to the second reader to make the change.

Now done.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-07-20 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 18:38 bug#49647: 27.2; Reference Manual sec. 10.2.4; Incorrect example for indirect-function Scott Marks
2021-07-19 23:59 ` Michael Heerdegen
2021-07-20 12:06   ` Lars Ingebrigtsen

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