Subject: bug#34506: 27.0.50: push-button bug with basic text-property button

From: Bob Weiner <[email-masked]>
Date: Sat, 16 Feb 2019 17:08:47 -0500

>From the Elisp manual (https://www.gnu.org/software/emacs/manual/html_node/elisp/Manipulating-Buttons.html), we have these accurate explanations:

  — Function: button-at pos
  Return the button at position pos in the current buffer, or nil. If the button at pos is a text property button, the return value is a marker pointing to pos.

  — Function: button-activate button &optional use-mouse-action
  Call button's action property (i.e., invoke the function that is the value of that property, passing it the single argument button). If use-mouse-action is non-nil, try to invoke the button's mouse-action property instead of action; if the button has no mouse-action property, use action as normal.

-----

With point on a "Choose" button in a customize-group buffer, point is on
a text-property button and (button-at (point)) returns a marker object
rather than a button whose action is a marker object.  Thus, if one
calls (push-button) at that location, it sends this marker object as the
button argument to 'button-activate' which then triggers an error when
it tries to funcall the button's action which is nil in this case.
Shouldn't there be additional logic that checks if the button itself is
a marker and then uses the button as the action in that case?

Related to this:  (button-type (button-at (point))) returns nil which seems
to contradict the fact that button-at returns non-nil.

Am I missing things here or does button-activate need additional code?

Thanks,

Bob

-------

In GNU Emacs 27.0.50 (build 13, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G1036))
 of 2017-12-17 built on bka-iMac.local
Repository revision: 36375d35aa06e84865cce678559ddfa8f79a9775
Windowing system distributor 'Apple', version 10.3.1561
Recent messages:
[Sat 04:46:35 PM] 
[Sat 04:46:35 PM] 
[Sat 04:46:35 PM] Result: nil
[Sat 04:46:37 PM] 
[Sat 04:46:37 PM] 
[Sat 04:46:37 PM] Result: nil
[Sat 04:46:38 PM] 
[Sat 04:46:38 PM] nil
[Sat 04:47:16 PM] 
Back to top level

Configured using:
 'configure --with-ns --with-imagemagick --without-pop --with-mailutils
 CC=clang 'CFLAGS=-O3 -g''

Configured features:
JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Custom

Minor modes in effect:
  recentf-mode: t
  treemacs-follow-mode: t
  treemacs-filewatch-mode: t
  treemacs-git-mode: deferred
  treemacs-fringe-indicator-mode: t
  async-bytecomp-package-mode: t
  diff-auto-refine-mode: t
  desktop-save-mode: t
  winner-mode: t
  which-key-mode: t
  which-function-mode: t
  persistent-scratch-autosave-mode: t
  global-edit-server-edit-mode: t
  delete-selection-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  column-number-indicator-zero-based: t
  dynamic-completion-mode: t
  eros-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-company-mode: t
  company-mode: t
  ace-window-display-mode: t
  major-mode-icons-mode: t
  minibuffer-depth-indicate-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t