From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 02 14:09:17 2010 Received: (at submit) by debbugs.gnu.org; 2 Oct 2010 18:09:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P26WL-000330-Eo for submit@debbugs.gnu.org; Sat, 02 Oct 2010 14:09:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P26WK-00032u-4v for submit@debbugs.gnu.org; Sat, 02 Oct 2010 14:09:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P26ZE-000743-Kr for submit@debbugs.gnu.org; Sat, 02 Oct 2010 14:12:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:47235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P26ZD-00073m-VN for submit@debbugs.gnu.org; Sat, 02 Oct 2010 14:12:16 -0400 Received: from [140.186.70.92] (port=44163 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P26Z9-0002mQ-K4 for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2010 14:12:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P26Z3-00072f-0M for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2010 14:12:06 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:47760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P26Z2-00072X-OC for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2010 14:12:04 -0400 Received: by wyb36 with SMTP id 36so5029410wyb.0 for ; Sat, 02 Oct 2010 11:12:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.10.145 with SMTP id 17mr5922269wev.27.1286043123566; Sat, 02 Oct 2010 11:12:03 -0700 (PDT) Received: by 10.216.67.195 with HTTP; Sat, 2 Oct 2010 11:12:03 -0700 (PDT) Date: Sat, 2 Oct 2010 14:12:03 -0400 X-Google-Sender-Auth: zlGL8uO2XpQ-Yppa20c83eYSGyA Message-ID: Subject: `set-marker' narrowing and proposed feature `buffer-narrowed-p' From: MON KEY To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) `set-marker' can not be set beyond value of `point-max' This is documented here: ,---- (info "(elisp)Moving Marker Positions") | | If POSITION is less than 1, `set-marker' moves MARKER to the | beginning of the buffer. If POSITION is greater than the size of | the buffer, `set-marker' moves marker to the end of the buffer. | If POSITION is `nil' or a marker that points nowhere, then MARKER | is set to point nowhere. | `---- Some mention in the above section should be made of `buffer-size' so users can now how to check if the buffer is narrowed. Likewise, docstrings of `>', `<', `<=', `>=', all indicate their arguments: ,---- | | Both must be numbers or markers. | `---- There is a discrepancy here in that the following signals an error: (let ((mk-mrk (make-marker))) (set-marker mk-mrk nil) (> mk-mrk (point-max))) ;=> (error "Marker does not point anywhere") Moreover, as the docstring of `set-marker' doesn't indicate that its range is bounded by the current values of `point-max' and `point-min' simple arithmetic checks for a markers value against some arbitrary buffer position can lead to confusing return values: (let ((mk-mrk (make-marker))) (progn (narrow-to-region (+ (point-min) 10) (- (point-max) 10)) (set-marker mk-mrk (1+ (point-max))) (widen)) `(,(= mk-mrk (point-max)) ,(>= mk-mrk (point-max)) ,(< mk-mrk (point-max)) ,(marker-position mk-mrk) ,(point-max))) ;=> (nil nil t ) (let ((mk-mrk (make-marker))) (set-marker mk-mrk (1+ (point-max))) (> mk-mrk (point-max))) ;=> nil (let ((mk-mrk (make-marker))) (set-marker mk-mrk 12000) (> mk-mrk (point-max))) ;=> nil (let ((mk-mrk (make-marker))) (set-marker mk-mrk 12000) (= (marker-position mk-mrk) 12000)) ;=> nil (let ((mk-mrk (make-marker))) (set-marker mk-mrk (1+ (point-max))) (> mk-mrk (1- (point-max)))) ;=> t I think some mention of these anomalies should be made in the respective docs in addition to the scattered lisp service provided by the manual. I would also like to propose addition of a new function `buffer-narrowed-p'. rgrep'ing buffer-narrowed-p in "lisp/" did not return any results... (defun buffer-narrowed-p (&optional buffer-or-name) "Test if buffer narrowing is in effect. When optional arg BUFFER-OR-NAME is non-nil check for narrowing in that buffer instead. Default is `current-buffer'.\n :EXAMPLE\n\n\(prog2 \(narrow-to-region \(line-beginning-position\) \(line-end-position\)\) \(buffer-narrowed-p \"*Help*\"\) \(widen\)\)\n" (let ((chk-bffr (if buffer-or-name (or (get-buffer buffer-or-name) (error "Optional arg BUFFER-OR-NAME does not find buffer: `%S'")) (current-buffer)))) (with-current-buffer chk-bffr (or (> (point-min) 1) (/= (buffer-size) (1- (point-max))) (/= (- (point-max) (point-min)) (buffer-size)))))) -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 07 05:00:50 2012 Received: (at 7151) by debbugs.gnu.org; 7 Sep 2012 09:00:50 +0000 Received: from localhost ([127.0.0.1]:45414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9uQh-0000vp-Ih for submit@debbugs.gnu.org; Fri, 07 Sep 2012 05:00:49 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:46833) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9uQe-0000vh-E6 for 7151@debbugs.gnu.org; Fri, 07 Sep 2012 05:00:45 -0400 Received: by ieak13 with SMTP id k13so4618257iea.3 for <7151@debbugs.gnu.org>; Fri, 07 Sep 2012 02:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=LhswzMQIP3PgYanaRmtrxLuYmKG5XBetH81zYmIvj18=; b=ADYX0JTUp36oY/uK5lRmsOiQG7kSvdtPUr3WPfm1KBsVUwWbPhiccAmJWwqWWreEL4 exYUK3123ogezX8vCjzXYvGBlOW41xW89WY4dbpHQJphi7dPfQRg8B9JbRagtRFdDPwU gRKObTDZZd4bYZgVr4bqRoda4ggSjMbXMZOJnhMUEvuaFI2Zk8qgr5fItgVF60MtUCBv ocJMnS2pTbtQcftEE85A8UY3PCKhsUke8ViVz6cmtaszqc+fl0FRa8xG3PH+ItG4qw76 FYPoF0a1Ern3qxgW5XgVTMCjT7xgrRy2Lt0uc507MEHjklqUlpsMvG7ZJWGxf32FYeiO ktPQ== Received: by 10.50.154.164 with SMTP id vp4mr7328955igb.66.1347008426890; Fri, 07 Sep 2012 02:00:26 -0700 (PDT) Received: from ulysses ([155.69.18.183]) by mx.google.com with ESMTPS id ce6sm7392890igb.1.2012.09.07.02.00.23 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 02:00:25 -0700 (PDT) From: Chong Yidong To: MON KEY Subject: Re: bug#7151: `set-marker' narrowing and proposed feature `buffer-narrowed-p' References: Date: Fri, 07 Sep 2012 17:00:20 +0800 In-Reply-To: (MON KEY's message of "Sat, 2 Oct 2010 14:12:03 -0400") Message-ID: <87ipbq5hsr.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 7151 Cc: 7151@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) MON KEY writes: > Some mention in the above section should be made of `buffer-size' so users can > now how to check if the buffer is narrowed. Done. Thanks for the suggestion. > Likewise, docstrings of `>', `<', `<=', `>=', all indicate their > arguments: > | Both must be numbers or markers. > There is a discrepancy here in that the following signals an error: > > (let ((mk-mrk (make-marker))) > (set-marker mk-mrk nil) > (> mk-mrk (point-max))) > ;=> (error "Marker does not point anywhere") > > I think some mention of these anomalies should be made in the > respective docs in addition to the scattered lisp service provided by > the manual. I don't think this is worth documenting; we don't document every single error condition, and this one is easy to figure out. > I would also like to propose addition of a new function > `buffer-narrowed-p'. Thanks for the suggestion. I committed a much simpler version. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 07 05:01:03 2012 Received: (at control) by debbugs.gnu.org; 7 Sep 2012 09:01:03 +0000 Received: from localhost ([127.0.0.1]:45418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9uQw-0000wO-81 for submit@debbugs.gnu.org; Fri, 07 Sep 2012 05:01:02 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:46833) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9uQt-0000vh-9K for control@debbugs.gnu.org; Fri, 07 Sep 2012 05:00:59 -0400 Received: by mail-ie0-f172.google.com with SMTP id k13so4618257iea.3 for ; Fri, 07 Sep 2012 02:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=Nl9K/Bdltwj1bs0oSXuKb0Wr6tvPAxOwaMY8Ou8jVik=; b=cx2AcLYouzTHiSG8xS95pAtQxJaDsHHNJh1cM/wkhHE0jStgJlKe9IUPCKMutVb6WO ysSBy1IDITR+twhSEDW7ASkOb2pF7GO3MAJxsn03SU6VnBioIz2n5BLrGZaPqN9hUpZb dr33OKnti/rw47JvpLF1+EdCYGOxJoQJ+MPOWFKmpPHrip48J3nJin4KDdpqDPNtwoZc 8HUB+S/L2rcT6zNqmc3P69x2wFGh7QEcKyOv6l3q7qC8LwPfU7eas716NXQ8gRPe8w+E Jm6K7vb72NMTsQcY/PDVMa4dicqJR/XOKb6aXsUQV67/k+mK+piGx7G/meoKW0hONOch +Weg== Received: by 10.50.237.2 with SMTP id uy2mr6886670igc.44.1347008442263; Fri, 07 Sep 2012 02:00:42 -0700 (PDT) Received: from ulysses ([155.69.18.183]) by mx.google.com with ESMTPS id fu4sm7387823igc.4.2012.09.07.02.00.40 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 02:00:41 -0700 (PDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 7151 Date: Fri, 07 Sep 2012 17:00:37 +0800 Message-ID: <87bohi5hsa.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) close 7151 thanks From unknown Sat Aug 16 10:46:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 05 Oct 2012 11:24:04 +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