unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33516: Should the docstring for flymake-diag-region mention behavior with narrowing?
@ 2018-11-26 17:46 Matthew Bregg
  2019-07-09 23:48 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Bregg @ 2018-11-26 17:46 UTC (permalink / raw)
  To: 33516


[-- Attachment #1.1: Type: text/plain, Size: 183 bytes --]

Currently it can be confusing when developing a flymake checker that
flymake-diag-region does not handle narrowing.

Updating the comment to mention this seems useful to me.

Thanks!

[-- Attachment #1.2: Type: text/html, Size: 252 bytes --]

[-- Attachment #2: 0001-Update-documentation-for-flymake.patch --]
[-- Type: text/x-patch, Size: 1119 bytes --]

From 0b4712c8553b918227bd58a2071a0dbdecaa04c0 Mon Sep 17 00:00:00 2001
From: Matthew Bregg <bregg@google.com>
Date: Fri, 16 Nov 2018 15:01:14 -0500
Subject: [PATCH] Update documentation for flymake.

Flymake flymake-diag-region does not mention behavior with narrowing, which can be confusing.
---
 lisp/progmodes/flymake.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index f0f93f1087..58bbbd500e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -384,7 +384,9 @@ verify FILTER, a function, and sort them by COMPARE (using KEY)."
 (defun flymake-diag-region (buffer line &optional col)
   "Compute BUFFER's region (BEG . END) corresponding to LINE and COL.
 If COL is nil, return a region just for LINE.  Return nil if the
-region is invalid."
+region is invalid.
+If the BUFFER has been narrowed,
+the region returned will correspond to the BUFFER's narrowed state."
   (condition-case-unless-debug _err
       (with-current-buffer buffer
         (let ((line (min (max line 1)
-- 
2.19.1.1215.g8438c0b245-goog


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

* bug#33516: Should the docstring for flymake-diag-region mention behavior with narrowing?
  2018-11-26 17:46 bug#33516: Should the docstring for flymake-diag-region mention behavior with narrowing? Matthew Bregg
@ 2019-07-09 23:48 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-09 23:48 UTC (permalink / raw)
  To: Matthew Bregg; +Cc: 33516

Matthew Bregg <bregg@google.com> writes:

> Currently it can be confusing when developing a flymake checker that
> flymake-diag-region does not handle narrowing.
>
> Updating the comment to mention this seems useful to me.

[...]

> -region is invalid."
> +region is invalid.
> +If the BUFFER has been narrowed,
> +the region returned will correspond to the BUFFER's narrowed state."

Hm...  I think we generally assume that all functions (except explicitly
documented not to) work on the narrowed section of a buffer?  So
documenting this in this specific function doesn't seem natural do me,
and I'm closing this bug report.  If somebody disagrees, please reopen.

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





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

end of thread, other threads:[~2019-07-09 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 17:46 bug#33516: Should the docstring for flymake-diag-region mention behavior with narrowing? Matthew Bregg
2019-07-09 23:48 ` 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).