From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 18 13:24:28 2024 Received: (at submit) by debbugs.gnu.org; 18 Feb 2024 18:24:28 +0000 Received: from localhost ([127.0.0.1]:37367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rblpz-0003Oj-0p for submit@debbugs.gnu.org; Sun, 18 Feb 2024 13:24:28 -0500 Received: from lists.gnu.org ([209.51.188.17]:53956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rblSa-0001mW-8S for submit@debbugs.gnu.org; Sun, 18 Feb 2024 13:00:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raxIZ-0002X9-7U for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 07:26:35 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raxIV-0001Cr-HG for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 07:26:34 -0500 Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-1d746ce7d13so5419895ad.0 for ; Fri, 16 Feb 2024 04:26:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708086389; x=1708691189; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=uOV5zmtC/a0ibv6m3vekXOIbjex9bvpb9Xyvk7Z/WKM=; b=hy226y1BeOEwNH9n2cBNeNiVm2rnnzs+s5nuMhiY1zMx20EdNM93e0WblTg9XJoqHf Ryj0HWPXYPpCpyiCC7EWon8SxiJ3JZkqmT+E82Jmfn9hiRhZ7sqt9gsoEhPGWxzgMryW Sk4m1t5ltX+/Me1agUOkGf0gc3kqzSrN60C0SyIBnR5TFAFH6yVtpmJfPaktcJA3kcbw iAdocBrnH32UyZKqhtXLfYUHCsRsz/XSbpafT/ik/7Yzpj/QmrmuNF/Fv08AkeFS/IwO VNyh7MWYK84+1ipoo3BcMSQC6lGnodx03XCLaMfmbDUfK0gFfZQ0PITppqombKF0OrNV Od7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708086389; x=1708691189; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uOV5zmtC/a0ibv6m3vekXOIbjex9bvpb9Xyvk7Z/WKM=; b=oEZduJgTOkaQildQ1TemC01AW4VtUYWrSXIkUn2D8nXVB1tLTifbwUMDpP7DNahuny Z4yTNJMXFt2uQqGIVi6Fb036/zRi0odjenzRxNwRIryxXX1V3Z6m9uEQawNJNVbStpec Y0WEvi+T3LQv69tiL4x6rTDxw1hKGXmN9p80AgQd51EETHrQH2Q8pDRqcik8469ZbUA1 XNMeStaj8NJHEkM8HwH1tAXLd0XcP83jDC+XYGz/hGUY+NDprXJrV4BqZv1Tp73jdDYV zQ58V130nBGirZBOcsJuGsg+LKFM63/usrnIUVfN0qa6lnQiZSsVnYIFChGWSZDD7c6k 09nA== X-Gm-Message-State: AOJu0YzPFd/OWLwz8bbl1jWT4eHzKcR2Wm9TC3MmGuRxDAWVHUccVr4L p9KWk3GQduUuFIkQ81H9moAdyXPhoBX4S4ej20ilJLa7/zpfixK5h3MaesY8vIE= X-Google-Smtp-Source: AGHT+IFVg67qi8Z/FGX007/w07ijO974nnqo3/ffewgiBZJNexPAnyhUDqwyu5XCLTqG9Ub0GH9eVw== X-Received: by 2002:a17:902:d2d1:b0:1db:9896:3eab with SMTP id n17-20020a170902d2d100b001db98963eabmr4279096plc.36.1708086388518; Fri, 16 Feb 2024 04:26:28 -0800 (PST) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id z19-20020a1709028f9300b001db4caef8d6sm2893507plo.161.2024.02.16.04.26.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 04:26:28 -0800 (PST) From: Visuwesh To: bug-gnu-emacs@gnu.org Subject: 30.0.50; number-at-point and bounds-of-thing-at-point disagree Date: Fri, 16 Feb 2024 17:56:20 +0530 Message-ID: <871q9c4mtv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x644.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.5 (----) The bounds returned by (bounds-of-thing-at-point 'number) does not match the bounds of the number returned by number-at-point. To demonstrate: 1. emacs -Q 2. Write any number in the scratch buffer, say 14.6. 3. With point on the number, say M-: (number-at-point) RET and observe 14.6 being returned. 4. Now say, M-: (let ((x (bounds-of-thing-at-point 'number))) (buffer-substring (car x) (cdr x))) RET and observe the incorrect value of 14 being returned. This is because the 'forward-op' property for 'number' thing is forward-word which fails in certain modes (not just in Elisp buffers, but also in LaTeX buffers). What do you think about a patch like below that adds an explicit bounds-of-thing-at-point property to 'number' thing? One thing to consider is that this patch includes the "0x" or "#x" prefix for base 16 numbers that number-at-point ignores. If you want to neglect it, then I can adjust the patch accordingly. diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 323d3d1cf6c..fc89331ea8c 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -765,6 +765,9 @@ number-at-point (string-to-number (buffer-substring (match-beginning 0) (match-end 0)))))) +(put 'number 'bounds-of-thing-at-point + (lambda () + (and (number-at-point) (cons (match-beginning 0) (match-end 0))))) (put 'number 'forward-op 'forward-word) (put 'number 'thing-at-point 'number-at-point) In GNU Emacs 30.0.50 (build 42, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw scroll bars) of 2024-01-31 built on astatine Repository revision: c4d16909fa4c30fd5f11bd66de7936790349cb7d Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101011 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json --without-xaw3d --without-gconf --without-libsystemd --with-cairo --with-xft' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LC_MONETARY: ta_IN.UTF-8 value of $LC_NUMERIC: ta_IN.UTF-8 value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: ELisp/l Minor modes in effect: bug-reference-prog-mode: t TeX-PDF-mode: t recentf-mode: t server-mode: t paredit-mode: t eros-mode: t flymake-mode: t pdf-occur-global-minor-mode: t minibuffer-depth-indicate-mode: t repeat-mode: t display-time-mode: t display-battery-mode: t delete-selection-mode: t xterm-mouse-mode: t straight-use-package-mode: t straight-package-neutering-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t use-hard-newlines: t tab-bar-history-mode: t tab-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t undelete-frame-mode: t minibuffer-regexp-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t abbrev-mode: t Load-path shadows: /home/viz/lib/emacs/straight/build/transient/transient hides /home/viz/lib/ports/emacs/lisp/transient /home/viz/lib/emacs/straight/build/org/ob-awk hides /home/viz/lib/ports/emacs/lisp/org/ob-awk /home/viz/lib/emacs/straight/build/org/org-capture hides /home/viz/lib/ports/emacs/lisp/org/org-capture /home/viz/lib/emacs/straight/build/org/ob-sql hides /home/viz/lib/ports/emacs/lisp/org/ob-sql /home/viz/lib/emacs/straight/build/org/ol-doi hides /home/viz/lib/ports/emacs/lisp/org/ol-doi /home/viz/lib/emacs/straight/build/org/org-plot hides /home/viz/lib/ports/emacs/lisp/org/org-plot /home/viz/lib/emacs/straight/build/org/ob-dot hides /home/viz/lib/ports/emacs/lisp/org/ob-dot /home/viz/lib/emacs/straight/build/org/ol-eshell hides /home/viz/lib/ports/emacs/lisp/org/ol-eshell /home/viz/lib/emacs/straight/build/org/ob-C hides /home/viz/lib/ports/emacs/lisp/org/ob-C /home/viz/lib/emacs/straight/build/org/ob-ref hides /home/viz/lib/ports/emacs/lisp/org/ob-ref /home/viz/lib/emacs/straight/build/org/org-list hides /home/viz/lib/ports/emacs/lisp/org/org-list /home/viz/lib/emacs/straight/build/org/org-mouse hides /home/viz/lib/ports/emacs/lisp/org/org-mouse /home/viz/lib/emacs/straight/build/org/ob-haskell hides /home/viz/lib/ports/emacs/lisp/org/ob-haskell /home/viz/lib/emacs/straight/build/org/ob-plantuml hides /home/viz/lib/ports/emacs/lisp/org/ob-plantuml /home/viz/lib/emacs/straight/build/org/org-keys hides /home/viz/lib/ports/emacs/lisp/org/org-keys /home/viz/lib/emacs/straight/build/org/org-clock hides /home/viz/lib/ports/emacs/lisp/org/org-clock /home/viz/lib/emacs/straight/build/org/ox-html hides /home/viz/lib/ports/emacs/lisp/org/ox-html /home/viz/lib/emacs/straight/build/org/oc-biblatex hides /home/viz/lib/ports/emacs/lisp/org/oc-biblatex /home/viz/lib/emacs/straight/build/org/ob-table hides /home/viz/lib/ports/emacs/lisp/org/ob-table /home/viz/lib/emacs/straight/build/org/ob hides /home/viz/lib/ports/emacs/lisp/org/ob /home/viz/lib/emacs/straight/build/org/ol-w3m hides /home/viz/lib/ports/emacs/lisp/org/ol-w3m /home/viz/lib/emacs/straight/build/org/ob-groovy hides /home/viz/lib/ports/emacs/lisp/org/ob-groovy /home/viz/lib/emacs/straight/build/org/org-footnote hides /home/viz/lib/ports/emacs/lisp/org/org-footnote /home/viz/lib/emacs/straight/build/org/org-entities hides /home/viz/lib/ports/emacs/lisp/org/org-entities /home/viz/lib/emacs/straight/build/org/ob-org hides /home/viz/lib/ports/emacs/lisp/org/ob-org /home/viz/lib/emacs/straight/build/org/org-macs hides /home/viz/lib/ports/emacs/lisp/org/org-macs /home/viz/lib/emacs/straight/build/org/ob-shell hides /home/viz/lib/ports/emacs/lisp/org/ob-shell /home/viz/lib/emacs/straight/build/org/ob-R hides /home/viz/lib/ports/emacs/lisp/org/ob-R /home/viz/lib/emacs/straight/build/org/ob-lisp hides /home/viz/lib/ports/emacs/lisp/org/ob-lisp /home/viz/lib/emacs/straight/build/org/ob-js hides /home/viz/lib/ports/emacs/lisp/org/ob-js /home/viz/lib/emacs/straight/build/org/ob-maxima hides /home/viz/lib/ports/emacs/lisp/org/ob-maxima /home/viz/lib/emacs/straight/build/org/ox-ascii hides /home/viz/lib/ports/emacs/lisp/org/ox-ascii /home/viz/lib/emacs/straight/build/org/org-persist hides /home/viz/lib/ports/emacs/lisp/org/org-persist /home/viz/lib/emacs/straight/build/org/ox-md hides /home/viz/lib/ports/emacs/lisp/org/ox-md /home/viz/lib/emacs/straight/build/org/org-duration hides /home/viz/lib/ports/emacs/lisp/org/org-duration /home/viz/lib/emacs/straight/build/org/ob-lilypond hides /home/viz/lib/ports/emacs/lisp/org/ob-lilypond /home/viz/lib/emacs/straight/build/org/ob-ruby hides /home/viz/lib/ports/emacs/lisp/org/ob-ruby /home/viz/lib/emacs/straight/build/org/ob-core hides /home/viz/lib/ports/emacs/lisp/org/ob-core /home/viz/lib/emacs/straight/build/org/ol-mhe hides /home/viz/lib/ports/emacs/lisp/org/ol-mhe /home/viz/lib/emacs/straight/build/org/ob-ditaa hides /home/viz/lib/ports/emacs/lisp/org/ob-ditaa /home/viz/lib/emacs/straight/build/org/ol-irc hides /home/viz/lib/ports/emacs/lisp/org/ol-irc /home/viz/lib/emacs/straight/build/org/ob-fortran hides /home/viz/lib/ports/emacs/lisp/org/ob-fortran /home/viz/lib/emacs/straight/build/org/org-feed hides /home/viz/lib/ports/emacs/lisp/org/org-feed /home/viz/lib/emacs/straight/build/org/ob-java hides /home/viz/lib/ports/emacs/lisp/org/ob-java /home/viz/lib/emacs/straight/build/org/ox hides /home/viz/lib/ports/emacs/lisp/org/ox /home/viz/lib/emacs/straight/build/org/oc-csl hides /home/viz/lib/ports/emacs/lisp/org/oc-csl /home/viz/lib/emacs/straight/build/org/ob-exp hides /home/viz/lib/ports/emacs/lisp/org/ob-exp /home/viz/lib/emacs/straight/build/org/org-loaddefs hides /home/viz/lib/ports/emacs/lisp/org/org-loaddefs /home/viz/lib/emacs/straight/build/org/ob-scheme hides /home/viz/lib/ports/emacs/lisp/org/ob-scheme /home/viz/lib/emacs/straight/build/org/ob-tangle hides /home/viz/lib/ports/emacs/lisp/org/ob-tangle /home/viz/lib/emacs/straight/build/org/ox-koma-letter hides /home/viz/lib/ports/emacs/lisp/org/ox-koma-letter /home/viz/lib/emacs/straight/build/org/ob-gnuplot hides /home/viz/lib/ports/emacs/lisp/org/ob-gnuplot /home/viz/lib/emacs/straight/build/org/org-crypt hides /home/viz/lib/ports/emacs/lisp/org/org-crypt /home/viz/lib/emacs/straight/build/org/org-datetree hides /home/viz/lib/ports/emacs/lisp/org/org-datetree /home/viz/lib/emacs/straight/build/org/org-attach hides /home/viz/lib/ports/emacs/lisp/org/org-attach /home/viz/lib/emacs/straight/build/org/ob-julia hides /home/viz/lib/ports/emacs/lisp/org/ob-julia /home/viz/lib/emacs/straight/build/org/ob-sqlite hides /home/viz/lib/ports/emacs/lisp/org/ob-sqlite /home/viz/lib/emacs/straight/build/org/org-cycle hides /home/viz/lib/ports/emacs/lisp/org/org-cycle /home/viz/lib/emacs/straight/build/org/org-faces hides /home/viz/lib/ports/emacs/lisp/org/org-faces /home/viz/lib/emacs/straight/build/org/org-mobile hides /home/viz/lib/ports/emacs/lisp/org/org-mobile /home/viz/lib/emacs/straight/build/org/org-ctags hides /home/viz/lib/ports/emacs/lisp/org/org-ctags /home/viz/lib/emacs/straight/build/org/ob-latex hides /home/viz/lib/ports/emacs/lisp/org/ob-latex /home/viz/lib/emacs/straight/build/org/ob-matlab hides /home/viz/lib/ports/emacs/lisp/org/ob-matlab /home/viz/lib/emacs/straight/build/org/ob-sed hides /home/viz/lib/ports/emacs/lisp/org/ob-sed /home/viz/lib/emacs/straight/build/org/org-attach-git hides /home/viz/lib/ports/emacs/lisp/org/org-attach-git /home/viz/lib/emacs/straight/build/org/ob-python hides /home/viz/lib/ports/emacs/lisp/org/ob-python /home/viz/lib/emacs/straight/build/org/ox-icalendar hides /home/viz/lib/ports/emacs/lisp/org/ox-icalendar /home/viz/lib/emacs/straight/build/org/org-tempo hides /home/viz/lib/ports/emacs/lisp/org/org-tempo /home/viz/lib/emacs/straight/build/org/ob-screen hides /home/viz/lib/ports/emacs/lisp/org/ob-screen /home/viz/lib/emacs/straight/build/org/org-num hides /home/viz/lib/ports/emacs/lisp/org/org-num /home/viz/lib/emacs/straight/build/org/ob-forth hides /home/viz/lib/ports/emacs/lisp/org/ob-forth /home/viz/lib/emacs/straight/build/org/ox-odt hides /home/viz/lib/ports/emacs/lisp/org/ox-odt /home/viz/lib/emacs/straight/build/org/ol-bbdb hides /home/viz/lib/ports/emacs/lisp/org/ol-bbdb /home/viz/lib/emacs/straight/build/org/org-table hides /home/viz/lib/ports/emacs/lisp/org/org-table /home/viz/lib/emacs/straight/build/org/ox-man hides /home/viz/lib/ports/emacs/lisp/org/ox-man /home/viz/lib/emacs/straight/build/org/ox-org hides /home/viz/lib/ports/emacs/lisp/org/ox-org /home/viz/lib/emacs/straight/build/org/ob-comint hides /home/viz/lib/ports/emacs/lisp/org/ob-comint /home/viz/lib/emacs/straight/build/org/ob-clojure hides /home/viz/lib/ports/emacs/lisp/org/ob-clojure /home/viz/lib/emacs/straight/build/org/org-id hides /home/viz/lib/ports/emacs/lisp/org/org-id /home/viz/lib/emacs/straight/build/org/oc-natbib hides /home/viz/lib/ports/emacs/lisp/org/oc-natbib /home/viz/lib/emacs/straight/build/org/ox-texinfo hides /home/viz/lib/ports/emacs/lisp/org/ox-texinfo /home/viz/lib/emacs/straight/build/org/org-agenda hides /home/viz/lib/ports/emacs/lisp/org/org-agenda /home/viz/lib/emacs/straight/build/org/org-src hides /home/viz/lib/ports/emacs/lisp/org/org-src /home/viz/lib/emacs/straight/build/org/ob-emacs-lisp hides /home/viz/lib/ports/emacs/lisp/org/ob-emacs-lisp /home/viz/lib/emacs/straight/build/org/ob-css hides /home/viz/lib/ports/emacs/lisp/org/ob-css /home/viz/lib/emacs/straight/build/org/ox-latex hides /home/viz/lib/ports/emacs/lisp/org/ox-latex /home/viz/lib/emacs/straight/build/org/oc hides /home/viz/lib/ports/emacs/lisp/org/oc /home/viz/lib/emacs/straight/build/org/ol hides /home/viz/lib/ports/emacs/lisp/org/ol /home/viz/lib/emacs/straight/build/org/org-element hides /home/viz/lib/ports/emacs/lisp/org/org-element /home/viz/lib/emacs/straight/build/org/org hides /home/viz/lib/ports/emacs/lisp/org/org /home/viz/lib/emacs/straight/build/org/org-goto hides /home/viz/lib/ports/emacs/lisp/org/org-goto /home/viz/lib/emacs/straight/build/org/ob-eval hides /home/viz/lib/ports/emacs/lisp/org/ob-eval /home/viz/lib/emacs/straight/build/org/org-habit hides /home/viz/lib/ports/emacs/lisp/org/org-habit /home/viz/lib/emacs/straight/build/org/org-pcomplete hides /home/viz/lib/ports/emacs/lisp/org/org-pcomplete /home/viz/lib/emacs/straight/build/org/ol-eww hides /home/viz/lib/ports/emacs/lisp/org/ol-eww /home/viz/lib/emacs/straight/build/org/ob-processing hides /home/viz/lib/ports/emacs/lisp/org/ob-processing /home/viz/lib/emacs/straight/build/org/org-timer hides /home/viz/lib/ports/emacs/lisp/org/org-timer /home/viz/lib/emacs/straight/build/org/org-inlinetask hides /home/viz/lib/ports/emacs/lisp/org/org-inlinetask /home/viz/lib/emacs/straight/build/org/ol-bibtex hides /home/viz/lib/ports/emacs/lisp/org/ol-bibtex /home/viz/lib/emacs/straight/build/org/org-fold-core hides /home/viz/lib/ports/emacs/lisp/org/org-fold-core /home/viz/lib/emacs/straight/build/org/oc-basic hides /home/viz/lib/ports/emacs/lisp/org/oc-basic /home/viz/lib/emacs/straight/build/org/ox-publish hides /home/viz/lib/ports/emacs/lisp/org/ox-publish /home/viz/lib/emacs/straight/build/org/oc-bibtex hides /home/viz/lib/ports/emacs/lisp/org/oc-bibtex /home/viz/lib/emacs/straight/build/org/org-macro hides /home/viz/lib/ports/emacs/lisp/org/org-macro /home/viz/lib/emacs/straight/build/org/ol-docview hides /home/viz/lib/ports/emacs/lisp/org/ol-docview /home/viz/lib/emacs/straight/build/org/org-fold hides /home/viz/lib/ports/emacs/lisp/org/org-fold /home/viz/lib/emacs/straight/build/org/org-lint hides /home/viz/lib/ports/emacs/lisp/org/org-lint /home/viz/lib/emacs/straight/build/org/org-version hides /home/viz/lib/ports/emacs/lisp/org/org-version /home/viz/lib/emacs/straight/build/org/ob-ocaml hides /home/viz/lib/ports/emacs/lisp/org/ob-ocaml /home/viz/lib/emacs/straight/build/org/ob-sass hides /home/viz/lib/ports/emacs/lisp/org/ob-sass /home/viz/lib/emacs/straight/build/org/ob-perl hides /home/viz/lib/ports/emacs/lisp/org/ob-perl /home/viz/lib/emacs/straight/build/org/ol-rmail hides /home/viz/lib/ports/emacs/lisp/org/ol-rmail /home/viz/lib/emacs/straight/build/org/org-protocol hides /home/viz/lib/ports/emacs/lisp/org/org-protocol /home/viz/lib/emacs/straight/build/org/ol-info hides /home/viz/lib/ports/emacs/lisp/org/ol-info /home/viz/lib/emacs/straight/build/org/ob-eshell hides /home/viz/lib/ports/emacs/lisp/org/ob-eshell /home/viz/lib/emacs/straight/build/org/org-refile hides /home/viz/lib/ports/emacs/lisp/org/org-refile /home/viz/lib/emacs/straight/build/org/ob-octave hides /home/viz/lib/ports/emacs/lisp/org/ob-octave /home/viz/lib/emacs/straight/build/org/ob-lua hides /home/viz/lib/ports/emacs/lisp/org/ob-lua /home/viz/lib/emacs/straight/build/org/ol-gnus hides /home/viz/lib/ports/emacs/lisp/org/ol-gnus /home/viz/lib/emacs/straight/build/org/ob-makefile hides /home/viz/lib/ports/emacs/lisp/org/ob-makefile /home/viz/lib/emacs/straight/build/org/org-archive hides /home/viz/lib/ports/emacs/lisp/org/org-archive /home/viz/lib/emacs/straight/build/org/ob-lob hides /home/viz/lib/ports/emacs/lisp/org/ob-lob /home/viz/lib/emacs/straight/build/org/ol-man hides /home/viz/lib/ports/emacs/lisp/org/ol-man /home/viz/lib/emacs/straight/build/org/org-compat hides /home/viz/lib/ports/emacs/lisp/org/org-compat /home/viz/lib/emacs/straight/build/org/org-colview hides /home/viz/lib/ports/emacs/lisp/org/org-colview /home/viz/lib/emacs/straight/build/org/org-indent hides /home/viz/lib/ports/emacs/lisp/org/org-indent /home/viz/lib/emacs/straight/build/org/ox-beamer hides /home/viz/lib/ports/emacs/lisp/org/ox-beamer /home/viz/lib/emacs/straight/build/org/ob-calc hides /home/viz/lib/ports/emacs/lisp/org/ob-calc Features: (shadow emacsbug bug-reference calc-lang calc-embed preview reporter desktop frameset tex-buf font-latex tex-mode flyspell ispell ecomplete tabify timezone org-capture doct gnus-dired help-fns radix-tree msb dictionary external-completion dictionary-connection typo etags fileloop imenu-xref display-line-numbers epa-file ement-room-list ement-lib ement-api ement-structs plz ement-macros taxy-magit-section magit-section benchmark taxy svg-lib persist flow-fill log-edit add-log smerge-mode calccomp calc-aent calc-misc calc-arith calc-math calc-alg calc-menu pcmpl-unix tramp-cmds gnus-cite mm-archive mail-extr gnus-bcklg qp textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check gnus-async sort gnus-ml nndraft nnmh nnmaildir nnagent nnml nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache avy misearch multi-isearch reveal xref dabbrev misc pulse color icomplete olivetti pdf-sync pdf-outline pdf-links pdf-history pdf-roll dired-aux shell-command+ network-stream url-http url-gw nsm url-cache url-auth latex latex-flymake tex-ispell tex-style tex tramp-cache time-stamp recentf tree-widget do-at-point mule-util cursor-sensor vc-backup log-view pcvs-util vc diff vc-git diff-mode vc-dispatcher face-remap org-pdftools pdf-annot facemenu org-noter latexenc oc-bibtex image-file image-converter oc-basic org-ql-find org-ql-completing-read org-ql-search org-ql-view transient ov crm org-super-agenda ht f f-shortdoc shortdoc s org-ql peg ts dash org-habit org-duration ob-gnuplot ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-icalendar org-agenda ox-html ox-mathml org-latex-preview ox-latex table ox-ascii ox-publish ox org-element org-persist avl-tree generator ob-fortran ob-python python compat compat-macs ob-calc calc-store calc-trail calc-ext calc calc-loaddefs rect calc-macs ob-C cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ob-shell ob-racket async ob-async cdlatex texmathp org-attach ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util mail-utils range mm-util mail-prsvr ol-docview doc-view ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi org-tempo org-id org-refile org-element-ast inline ol-man org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie treesit executable ob-comint org-pcomplete org-list org-footnote org-faces org-entities noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs org-version org-compat org-macs server paredit edmacro kmacro eros checkdoc lisp-mnt flymake project warnings thingatpt wordel-autoloads mines-autoloads sokoban-autoloads ement-autoloads svg-lib-autoloads taxy-magit-section-autoloads magit-section-autoloads taxy-autoloads persist-autoloads plz-autoloads nov-autoloads esxml-autoloads kv-autoloads transmission-autoloads csv-mode-autoloads lua-mode-autoloads nix-mode-autoloads gnuplot-autoloads go-mode-autoloads racket-mode-autoloads eros-autoloads writegood-mode-autoloads do-at-point-autoloads siege-mode-autoloads paredit-autoloads puni-autoloads expand-region-autoloads filladapt-autoloads compose org-ql-autoloads transient-autoloads peg-autoloads ov-autoloads org-super-agenda-autoloads ts-autoloads ht-autoloads f-autoloads s-autoloads dash-autoloads scroll-other-window org-pdftools-autoloads org-noter-autoloads change-env-autoloads math-delimiters-autoloads doct-autoloads ob-async-autoloads async-autoloads emacs-ob-racket-autoloads valign-autoloads cdlatex-autoloads tempo bibtex auctex-autoloads tex-site pdf-occur ibuf-ext ibuffer ibuffer-loaddefs tablist advice tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch let-alist pdf-misc imenu pdf-tools package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse url-vars compile cus-edit wid-edit pdf-view jka-compr pdf-cache pdf-info tq pdf-util pdf-macs image-mode dired-x dired dired-loaddefs exif pdf-tools-autoloads tablist-autoloads typo-autoloads mb-depth repeat visual-fill-autoloads olivetti-autoloads time battery filenotify dom tamil99 quail disp-table lacarte-autoloads shell-command-plus-autoloads icons delsel easy-mmode xt-mouse cus-load avy-autoloads icalendar diary-lib diary-loaddefs cal-menu calendar cal-loaddefs dired-du-autoloads finder-inf filecache imenu-xref-autoloads ert ewoc debug backtrace find-func qrencode-autoloads derived tochemfig-autoloads chemtable-autoloads molar-mass-autoloads vc-backup-autoloads compat-autoloads skeleton saveplace-pdf-view saveplace tramp-sh tramp trampver tramp-integration files-x tramp-message tramp-compat xdg shell pcomplete comint ansi-osc ring parse-time iso8601 time-date format-spec auth-source eieio eieio-core password-cache json map byte-opt ansi-color tramp-loaddefs bookmark text-property-search pp saveplace-pdf-view-autoloads dbus xml rx inspector-autoloads xr-autoloads org-mode-autoloads pcase straight-autoloads cl-seq info cl-extra help-mode straight subr-x cl-macs gv cl-loaddefs cl-lib bytecomp byte-compile vz-nh-theme vz-options-theme rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 2513315 412071) (symbols 48 59758 89) (strings 32 331770 67417) (string-bytes 1 53668308) (vectors 16 142741) (vector-slots 8 2164856 283096) (floats 8 121532 13469) (intervals 56 114483 1273) (buffers 976 81)) From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 24 04:18:02 2024 Received: (at 69239) by debbugs.gnu.org; 24 Feb 2024 09:18:02 +0000 Received: from localhost ([127.0.0.1]:41654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdoAQ-0006Ny-NK for submit@debbugs.gnu.org; Sat, 24 Feb 2024 04:18:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdoAL-0006NR-Gn for 69239@debbugs.gnu.org; Sat, 24 Feb 2024 04:17:57 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdo9s-0000hc-2f; Sat, 24 Feb 2024 04:17:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=j9WWoeSWX/EVm+aSoe44f1bswFkVyU/OSRW+BOwp/jY=; b=KiCoK1KNfCwC D4exb45gXxRST4jBxSG4OSwr+2WmqUSnrOc/t2RNwhDzoMpFfaKkdRJ4+IaVDMD/LX2KYUDk2yODW 3+0K53PyE8thiFpOWcoXzgRhd0sRAOe1H1EFo8Km6QDFDQeGj8aIc7OgJ1DPfXSiLs1nQ/08h49+z WJ2S5Od9QRhUeHhd/KQRqFj8jVMGBI81WDXPzYIy+6E2ZNvkfZ++SaCo3E4i7JodX7Erfy3a9dUK8 htHhjojSqPRVHysPLDalkoZFe+ocxMHhGUP03AE0V5AWajnpxM7m0uLRw/Tog5ATCQ2HZvXqYWEiA /QI1CfnIJrc4tLTVS9DVTA==; Date: Sat, 24 Feb 2024 11:17:20 +0200 Message-Id: <86o7c6z0f3.fsf@gnu.org> From: Eli Zaretskii To: Visuwesh In-Reply-To: <871q9c4mtv.fsf@gmail.com> (message from Visuwesh on Fri, 16 Feb 2024 17:56:20 +0530) Subject: Re: bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree References: <871q9c4mtv.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69239 Cc: 69239@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Visuwesh > Date: Fri, 16 Feb 2024 17:56:20 +0530 > > > The bounds returned by (bounds-of-thing-at-point 'number) does not match > the bounds of the number returned by number-at-point. To demonstrate: > > 1. emacs -Q > 2. Write any number in the scratch buffer, say 14.6. > 3. With point on the number, say M-: (number-at-point) RET and > observe 14.6 being returned. > 4. Now say, > > M-: (let ((x (bounds-of-thing-at-point 'number))) (buffer-substring (car x) (cdr x))) RET > > and observe the incorrect value of 14 being returned. > > This is because the 'forward-op' property for 'number' thing is > forward-word which fails in certain modes (not just in Elisp buffers, > but also in LaTeX buffers). What do you think about a patch like below > that adds an explicit bounds-of-thing-at-point property to 'number' > thing? We could perhaps add something like this, but I don't think bounds-of-thing-at-point can call THING-at-point for some THING, because thing-at-point will cal bounds-of-thing-at-point, so this could lead to an infinite recursion, right? So the implementation will need to change not to call number-at-point. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 24 23:43:47 2024 Received: (at 69239) by debbugs.gnu.org; 25 Feb 2024 04:43:47 +0000 Received: from localhost ([127.0.0.1]:37809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re6Mc-0005oH-PC for submit@debbugs.gnu.org; Sat, 24 Feb 2024 23:43:47 -0500 Received: from mail-oo1-f66.google.com ([209.85.161.66]:52586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re6Ma-0005nj-HE for 69239@debbugs.gnu.org; Sat, 24 Feb 2024 23:43:45 -0500 Received: by mail-oo1-f66.google.com with SMTP id 006d021491bc7-5a027fda5aeso1172580eaf.1 for <69239@debbugs.gnu.org>; Sat, 24 Feb 2024 20:43:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708836134; x=1709440934; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6xvOfvpiMENImMIC4px67D54yIl/sXKQrP0tmWoax0E=; b=hS0lXMmzsbNifz3uWfwp2ZSMf8QXMJcmBSYEuOJNSaQnVSWaOyOrOri+4zLJcrxGRv JNhZpGjtyOuFirE3nLxx2j1pt6yt6Siotnh6/7v1Jm5c/ioFWeLAfcDKc2iimm7ER3XD TTV0PqmneD/9DvX7PIKA/MVqlizU0glQOWluV6JUan5T8cMBQm40mmnB1YNVy+ms2t6z Nf1CTZZLEWedukxjWkAHG5Tcmzymc40w6VjSKTym/Q8+vQIIsxJ3y9kEuyb2ZjgebsqJ SFnsaKaJMBPFwKX6cnER4eJ0ImuMm6/Kqab317QoXbX/nqa3YUuXyamAgc6PzcWU/cbK xAuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708836134; x=1709440934; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6xvOfvpiMENImMIC4px67D54yIl/sXKQrP0tmWoax0E=; b=UprC0167QnCuJ/0H2FUfemb7BRdZ00n9rhmRImsrG+NM79qIeOWLU5lOl4vpljn5cZ putOnq/n42MsODFwVkJuW48d1/VI3OVvezRRCUCMER2IUHM//PmHtVb7iJczBUF2ZJjg peW/nbo2RpQ59uY70IkIyp4FBPPDV3JBnpGxBAdk8NxpznEEjP8y4yIpGxBf8NBb5KXr xkIiK/cW6cBC4oxMKG8FdK0VwIuZH788UcBzSNASGwWLn6ygBfi9MVqtzSp4AcFS6thq i7c3lkNNxXbI+ixH7AxnJx14THN5waHd+S3+NdUjAkw1XY/4dO+CzUQYRfNpD+7Cr1ma KrUw== X-Gm-Message-State: AOJu0Yx/mMkoBKEPKS0RMe0MSa5/d0QVyKlvmpxbEmb2Sj6m0qmJbBlR BSSGLoURy8TnF3sBPPiigxen9OV8iAFLCktZfZFQzCw6Z+1Z9kM4 X-Google-Smtp-Source: AGHT+IFR5ccINr+8xGdc3xhf6JOXrGPTSNkn42WSMU3oWYuXF4uO1IdjBdfCv6B5KjlnEBuIX9YE0w== X-Received: by 2002:a05:6358:16d4:b0:17b:6171:adaa with SMTP id r20-20020a05635816d400b0017b6171adaamr6210891rwl.20.1708836133667; Sat, 24 Feb 2024 20:42:13 -0800 (PST) Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id fy16-20020a17090b021000b0029aac9c523fsm866888pjb.47.2024.02.24.20.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:42:13 -0800 (PST) From: Visuwesh To: Eli Zaretskii Subject: Re: bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree In-Reply-To: <86o7c6z0f3.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Feb 2024 11:17:20 +0200") References: <871q9c4mtv.fsf@gmail.com> <86o7c6z0f3.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sun, 25 Feb 2024 10:12:10 +0530 Message-ID: <87sf1hi28t.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69239 Cc: 69239@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=AA=E0=AE=BF=E0=AE=AA=E0=AF=8D=E0=AE=B0= =E0=AE=B5=E0=AE=B0=E0=AE=BF 24, 2024] Eli Zaretskii wrote: >> From: Visuwesh >> Date: Fri, 16 Feb 2024 17:56:20 +0530 >>=20 >>=20 >> The bounds returned by (bounds-of-thing-at-point 'number) does not match >> the bounds of the number returned by number-at-point. To demonstrate: >>=20 >> 1. emacs -Q >> 2. Write any number in the scratch buffer, say 14.6. >> 3. With point on the number, say M-: (number-at-point) RET and >> observe 14.6 being returned. >> 4. Now say,=20 >>=20 >> M-: (let ((x (bounds-of-thing-at-point 'number))) (buffer-substri= ng (car x) (cdr x))) RET >>=20 >> and observe the incorrect value of 14 being returned. >>=20 >> This is because the 'forward-op' property for 'number' thing is >> forward-word which fails in certain modes (not just in Elisp buffers, >> but also in LaTeX buffers). What do you think about a patch like below >> that adds an explicit bounds-of-thing-at-point property to 'number' >> thing? > > We could perhaps add something like this, but I don't think > bounds-of-thing-at-point can call THING-at-point for some THING, > because thing-at-point will cal bounds-of-thing-at-point, so this > could lead to an infinite recursion, right? Looking at the definition of thing-at-point, it checks if THING's symbol property 'thing-at-point is non-nil first before falling back to using bounds-of-thing-at-point for THING. (cond ((let ((alist thing-at-point-provider-alist) elt result) ... result)) ((get thing 'thing-at-point) <<<<<<< (funcall (get thing 'thing-at-point))) (t (let ((bounds (bounds-of-thing-at-point thing))) <<<<<<< (when bounds (buffer-substring (car bounds) (cdr bounds)))))) Since number already has the property 'thing-at-point defined, we should be fine with using number-at-point in bounds-of-thing-at-point function for number. > So the implementation will need to change not to call number-at-point. But if you want to be on the safer side, then I can write a patch that doesn't use number-at-point. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 25 02:10:25 2024 Received: (at 69239) by debbugs.gnu.org; 25 Feb 2024 07:10:25 +0000 Received: from localhost ([127.0.0.1]:48397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re8eW-00058u-IH for submit@debbugs.gnu.org; Sun, 25 Feb 2024 02:10:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re8Qs-0004S7-V5 for 69239@debbugs.gnu.org; Sun, 25 Feb 2024 01:56:19 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1re89m-0002IK-Sh; Sun, 25 Feb 2024 01:38:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=uQW7NUmFNraK2wsASIL/RS534WXU6sT7zd97lqI26VQ=; b=fhktdE1PL18O2P4eaRFY tIPn60cbZ7NvrmCMHCqm3cCCsJ1E0+Y4+4TOjAPjixHmYoT7oyoccRUOjdH7ECevHSVCQlhZiXQlq CSQOrDXV9H7YL4iJNExJujjvGgfqBQ7sg8Ii2WLKsaBXNu6zdNXS+fh4I0qx3tS9haS8weDMkaLYj Kuh29faSFAd3ClMpmGa1GpYINQTRL2ZqGv7iPLn3xXvQVUYMhRyqescCqjNBaAJuvzZYIRVKZSitu BVVXR5DFDbnsU9d75UeZtmO8CMSJ5F91rq0taHxgVw/CT/in3y+1RRveHLT5XHJVmvYYlFv1+Rflr QQc0Vi1ZjCTPWA==; Date: Sun, 25 Feb 2024 08:38:34 +0200 Message-Id: <86cyslxd3p.fsf@gnu.org> From: Eli Zaretskii To: Visuwesh In-Reply-To: <87sf1hi28t.fsf@gmail.com> (message from Visuwesh on Sun, 25 Feb 2024 10:12:10 +0530) Subject: Re: bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree References: <871q9c4mtv.fsf@gmail.com> <86o7c6z0f3.fsf@gnu.org> <87sf1hi28t.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69239 Cc: 69239@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Visuwesh > Cc: 69239@debbugs.gnu.org > Date: Sun, 25 Feb 2024 10:12:10 +0530 > > [சனி பிப்ரவரி 24, 2024] Eli Zaretskii wrote: > > > We could perhaps add something like this, but I don't think > > bounds-of-thing-at-point can call THING-at-point for some THING, > > because thing-at-point will cal bounds-of-thing-at-point, so this > > could lead to an infinite recursion, right? > > Looking at the definition of thing-at-point, it checks if THING's symbol > property 'thing-at-point is non-nil first before falling back to using > bounds-of-thing-at-point for THING. I know, but the code clearly tells us that bounds-of-thing-at-point is a lower-level primitive than thing-at-point, so the former should not call the latter. > But if you want to be on the safer side, then I can write a patch that > doesn't use number-at-point. Yes, please. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 04:49:49 2024 Received: (at 69239) by debbugs.gnu.org; 9 Mar 2024 09:49:49 +0000 Received: from localhost ([127.0.0.1]:60712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ritKu-0002Q3-JS for submit@debbugs.gnu.org; Sat, 09 Mar 2024 04:49:48 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:48548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ritKr-0002Po-Ov for 69239@debbugs.gnu.org; Sat, 09 Mar 2024 04:49:46 -0500 Received: by mail-pl1-f193.google.com with SMTP id d9443c01a7336-1dd7df835a8so2241765ad.1 for <69239@debbugs.gnu.org>; Sat, 09 Mar 2024 01:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709977687; x=1710582487; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=L+gK/f5sJWi/PDpfTH55rihgTSKMO9odvgNoo6jT1Rg=; b=FOflNrMOsvKkiE9D7GWqbSmKDttrqodIxj2y1hMINoyJaZkeaqtKj1SbIU2UVz5fG7 yJoVKaBOE/LearwRWP2ikjpx0ipKxhA+XhkB0AHLANLbBt97SJRIL77Err3TPt/0IDzn chuudYEkhXoQ/aMBeTcvpwkt2pLelNZIZ+XjHY0tU9tohV5WVmO1nxjZXh1p7s77a/56 dm4mqjtfmYlYm+5iWiIfj3SiNQ6QW7yNEqm7G1DNJfl/kCz7gV09Wu1DZmHfdtWL3HW/ JAsSQ0Dz1TsJ3CrWZ6ZUmcTr8q+EjUvubqM4Rtv0f5ipi26KOcvSyxuRRD0kQ9Ko0zLS nMcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709977687; x=1710582487; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L+gK/f5sJWi/PDpfTH55rihgTSKMO9odvgNoo6jT1Rg=; b=Vrw3IogWJgH8LPxc1TJOsOSbAWG0sUtonhg0VCjx+FQhWNLXqcLLkNkjfNRXjdr5h9 AkAm656nRVz7EqP5BT2z0wYHLBwyiNrcXY0OhmXEVI00rYiRTassHxDZIjlluRqKh6ju BDGVzsQpNrk91zxv8CWB4gnfazTFpOlfDp4TN2tqqENPArOmM3dhDHIh2OcqsVNyBFhC A3q8HdXqSOt3V1+JHozvv/fRuGlKGtRMIyjEjo6kdEeLoh9oynR8y+I3jFNZNYhBnP1o Tx0eLS55IFg4n5arArTQinhj80/gnrttiCSryNk9AaoihALFFDJ17QSxJEpaijNx68Pk Kr5w== X-Gm-Message-State: AOJu0YwjNg8ioK45+a+vEsf5fiSUSaFdEwmj1cc57YqpsE254+gedXeW IEEP632s13ZBvF9w6j+at3ZUYWwe37fv6FXR+syVZm+TlJSeLPockR+omtog5Ms= X-Google-Smtp-Source: AGHT+IGZFZ8b6ihfQx3WTMspF764fsSySRk6eNP5PZjets7ARYpQAU+R9LTl+RF9LfVpCKz8SiRyrw== X-Received: by 2002:a17:902:e88f:b0:1dd:7d71:66ea with SMTP id w15-20020a170902e88f00b001dd7d7166eamr1005716plg.53.1709977687180; Sat, 09 Mar 2024 01:48:07 -0800 (PST) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id g10-20020a1709026b4a00b001dd6a0580e3sm966329plt.280.2024.03.09.01.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 01:48:06 -0800 (PST) From: Visuwesh To: Eli Zaretskii Subject: Re: bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree In-Reply-To: <86cyslxd3p.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 25 Feb 2024 08:38:34 +0200") References: <871q9c4mtv.fsf@gmail.com> <86o7c6z0f3.fsf@gnu.org> <87sf1hi28t.fsf@gmail.com> <86cyslxd3p.fsf@gnu.org> Date: Sat, 09 Mar 2024 15:18:03 +0530 Message-ID: <8734szg2i4.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69239 Cc: 69239@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=AA=E0=AE=BF= =E0=AE=AA=E0=AF=8D=E0=AE=B0=E0=AE=B5=E0=AE=B0=E0=AE=BF 25, 2024] Eli Zarets= kii wrote: >> But if you want to be on the safer side, then I can write a patch that >> doesn't use number-at-point. > > Yes, please. > > Thanks. Sorry for the delay, life had me busy. Please find attached patch. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-bounds-of-thing-at-point-property-for-number.patch >From f402a765365ec76f741d8eaffb75f4177abb1261 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Sat, 9 Mar 2024 15:17:26 +0530 Subject: [PATCH] Add bounds-of-thing-at-point property for 'number' * lisp/thingatpt.el (thing-at-point-decimal-regexp) (thing-at-point-hexadecimal-regexp): Extract regexps from... (number-at-point): here. Use above. (number): Add 'bounds-of-thing-at-point' property as `forward-word' does not always return the right boundary e.g., in latex-mode buffers. (bug#69239) --- lisp/thingatpt.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 83ddc640d35..7896ad984df 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -735,20 +735,33 @@ symbol-at-point (let ((thing (thing-at-point 'symbol))) (if thing (intern thing)))) +(defvar thing-at-point-decimal-regexp + "-?[0-9]+\\.?[0-9]*" + "A regexp matching a decimal number.") + +(defvar thing-at-point-hexadecimal-regexp + "\\(0x\\|#x\\)\\([a-fA-F0-9]+\\)" + "A regexp matchin a hexadecimal number.") + ;;;###autoload (defun number-at-point () "Return the number at point, or nil if none is found. Decimal numbers like \"14\" or \"-14.5\", as well as hex numbers like \"0xBEEF09\" or \"#xBEEF09\", are recognized." (cond - ((thing-at-point-looking-at "\\(0x\\|#x\\)\\([a-fA-F0-9]+\\)" 500) + ((thing-at-point-looking-at thing-at-point-hexadecimal-regexp 500) (string-to-number (buffer-substring (match-beginning 2) (match-end 2)) 16)) - ((thing-at-point-looking-at "-?[0-9]+\\.?[0-9]*" 500) + ((thing-at-point-looking-at thing-at-point-decimal-regexp 500) (string-to-number (buffer-substring (match-beginning 0) (match-end 0)))))) +(put 'number 'bounds-of-thing-at-point + (lambda () + (and (or (thing-at-point-looking-at thing-at-point-hexadecimal-regexp 500) + (thing-at-point-looking-at thing-at-point-decimal-regexp 500)) + (cons (match-beginning 0) (match-end 0))))) (put 'number 'forward-op 'forward-word) (put 'number 'thing-at-point 'number-at-point) -- 2.43.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 05:42:58 2024 Received: (at 69239-done) by debbugs.gnu.org; 14 Mar 2024 09:42:58 +0000 Received: from localhost ([127.0.0.1]:48362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkhc1-000291-NG for submit@debbugs.gnu.org; Thu, 14 Mar 2024 05:42:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkhc0-00028r-VL for 69239-done@debbugs.gnu.org; Thu, 14 Mar 2024 05:42:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkhbM-00037l-1U; Thu, 14 Mar 2024 05:42:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1xOB8oRH1YaLmqhOnbBLLNhDtVC67bW1idDVJ7BS6gs=; b=SDHaT6Af4kSj/HKre6vS qMhI9iJdyxdiMNxSQ/89891XLHZxVeBIpMs3MX/WbOJb/c50sCVDnc+sOJPktdmCiWHq8XfnllAcr zBVQ5rsLq1LVRFDwznG14cpDKFxVEgTe0+6GXGzXvHLcpsDcucaL4LxSACyQ4bnrJ23uf2XpDa0yw o5zBzPySTO4Whwscjk1bl2ADso5YCz3BUPGhhnrK4K0Tmf8y2Oi2eerXHEy52d3CxAQToEbDUp9cj izYp7H3AGNDW46iinm7dX5H8Lco5gOULbH/vQdIboxVvV8tPdlPEdQJAPepIHgtc+4kYo7ZLqwsl8 eAB1rjTh1tyIIg==; Date: Thu, 14 Mar 2024 11:42:13 +0200 Message-Id: <8634stb156.fsf@gnu.org> From: Eli Zaretskii To: Visuwesh In-Reply-To: <8734szg2i4.fsf@gmail.com> (message from Visuwesh on Sat, 09 Mar 2024 15:18:03 +0530) Subject: Re: bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree References: <871q9c4mtv.fsf@gmail.com> <86o7c6z0f3.fsf@gnu.org> <87sf1hi28t.fsf@gmail.com> <86cyslxd3p.fsf@gnu.org> <8734szg2i4.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69239-done Cc: 69239-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Visuwesh > Cc: 69239@debbugs.gnu.org > Date: Sat, 09 Mar 2024 15:18:03 +0530 > > [ஞாயிறு பிப்ரவரி 25, 2024] Eli Zaretskii wrote: > > >> But if you want to be on the safer side, then I can write a patch that > >> doesn't use number-at-point. > > > > Yes, please. > > > > Thanks. > > Sorry for the delay, life had me busy. Please find attached patch. Thanks, installed on master, and closing the bug. From unknown Sat Jun 21 03:25:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 11 Apr 2024 11:24:21 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator