From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: brubar.cs@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#21437: 24.4; `checkdoc-current-buffer' does not check the current buffer. Date: Tue, 08 Sep 2015 22:12:26 +0200 Message-ID: <87vbbk3c2d.fsf@tosh-laptop.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1441744302 6638 80.91.229.3 (8 Sep 2015 20:31:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Sep 2015 20:31:42 +0000 (UTC) To: 21437@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 08 22:31:29 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZZPXs-0005RL-J2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 22:31:12 +0200 Original-Received: from localhost ([::1]:37299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPXs-0007PM-Ql for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 16:31:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPXo-0007Mz-2a for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 16:31:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZPXi-00038I-BY for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 16:31:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPXi-00038C-8r for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 16:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZZPXh-0001FC-Ud for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 16:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: brubar.cs@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Sep 2015 20:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21437 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14417442394737 (code B ref -1); Tue, 08 Sep 2015 20:31:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Sep 2015 20:30:39 +0000 Original-Received: from localhost ([127.0.0.1]:53063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZPXJ-0001EH-IY for submit@debbugs.gnu.org; Tue, 08 Sep 2015 16:30:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56019) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZP3C-0000S6-21 for submit@debbugs.gnu.org; Tue, 08 Sep 2015 15:59:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZP3A-0003SJ-EM for submit@debbugs.gnu.org; Tue, 08 Sep 2015 15:59:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZP3A-0003SF-BN for submit@debbugs.gnu.org; Tue, 08 Sep 2015 15:59:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZP39-0007RM-6s for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:59:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZP34-0003RY-0q for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:59:27 -0400 Original-Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:37818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZP33-0003RB-MT for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:59:21 -0400 Original-Received: by wicfx3 with SMTP id fx3so127451696wic.0 for ; Tue, 08 Sep 2015 12:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=GQ5kl2TkcSGR6UlVTWV5A1DL8y5AgTaR0zY+iwUVFJM=; b=fPMiC4i30RQsS6HkfMyy9j28jw7mn66Rqd+p1qAIuyXOE7RT0sekXxhOYR4BwzHDFW yWtvBnQJf0W5xlbWAKwe1OexEMIN0IsjKST8wDhpNM94HO+UH/pqLGYQPpiNqgBA7hsP P4r112vqaR4NgBqYrsYfS1wOtxZgFy6HNmTc2UCiGiK1Uk7wxl2R1AL5Z4nLtMDrKjDN FzXo94OT9RbzBRKoUWtO+Bu5D8qPcqP4da0qX8/0JhizhIrnqzovMLWksjivpQF1RQEp 7EC6sHC0eZisbv/cHbCDsjPbtynaz8OdayeSQ0gdA2Wk+6LR8U2OAoQ8/mi3PsflgV6g AOPg== X-Received: by 10.194.246.136 with SMTP id xw8mr50602483wjc.42.1441742360628; Tue, 08 Sep 2015 12:59:20 -0700 (PDT) Original-Received: from tosh-laptop (sta21-6-78-240-71-23.fbx.proxad.net. [78.240.71.23]) by smtp.gmail.com with ESMTPSA id gc8sm123971wib.2.2015.09.08.12.59.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Sep 2015 12:59:19 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Tue, 08 Sep 2015 16:30:33 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106273 Archived-At: --=-=-= Content-Type: text/plain Hi, I wanted to use `checkdoc-current-buffer' programmatically. Unfortunately, it seems the function `checkdoc-current-buffer' may check part of a buffer that is not the current buffer. Running the attached file 'test-checkdoc-buffer.el' with the command: emacs -Q --batch --eval='(progn (find-file "./test-checkdoc-buffer.el") (eval-buffer))' will print: ERROR `checkdoc-current-buffer' didn't check the current buffer which means `checkdoc-current-buffer' checked (part of) the buffer: "*NOT THE BUFFER TO CHECK*" instead of the requested buffer: "test-checkdoc-buffer.el" Also, loading this file 'test-checkdoc-buffer.el' and using `eval-buffer' will show the resulting wrong "*Style Warnings*" buffer. It seems to me that, in `checkdoc-show-diagnostics', the instructions (pop-to-buffer b) ... (other-window -1) are putting emacs in a window/buffer configuration that checkdoc does not understand. Bruno. In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2015-01-23 on tosh-laptop Windowing system distributor `The X.Org Foundation', version 11.0.11502000 Configured using: `configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --libdir=/usr/lib64 --program-suffix=-emacs-24 --infodir=/usr/share/info/emacs-24 --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --with-gameuser=games --without-compress-install --with-file-notification=inotify --enable-acl --with-dbus --without-gnutls --without-gpm --without-hesiod --without-kerberos --without-kerberos5 --with-xml2 --without-selinux --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns --without-gconf --without-gsettings --without-toolkit-scroll-bars --without-gif --with-jpeg --with-png --with-rsvg --without-tiff --with-xpm --with-imagemagick --with-xft --without-libotf --without-m17n-flt --with-x-toolkit=gtk3 GENTOO_PACKAGE=app-editors/emacs-24.4-r1 'CFLAGS=-O2 -pipe -march=native' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Important settings: value of $LC_CTYPE: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: tooltip-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 Recent input: M-x e m a c s SPC r o b u r e p o r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind inotify dynamic-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 73067 6118) (symbols 48 17633 0) (miscs 40 44 185) (strings 32 9414 3792) (string-bytes 1 259601) (vectors 16 9000) (vector-slots 8 384484 17472) (floats 8 65 139) (intervals 56 362 16) (buffers 960 13) (heap 1024 40891 1094)) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-checkdoc-buffer.el Content-Transfer-Encoding: quoted-printable Content-Description: checkdoc-current-buffer bug test file ;; In `checkdoc-show-diagnostics', the instruction: ;;=20 ;; (pop-to-buffer b) ;; ... ;; (other-window -1) ;;=20=20=20=20=20=20=20 ;; put the buffer/window configuration into a state checkdock is not ;; able to cope with: the current buffer becomes the wrong one. Then ;; `checkdoc-current-buffer' ends up checking a buffer unrelated with ;; the buffer that was current when entering the function ;; `checkdoc-current-buffer'. ;;=20 ;; The test below shows that `checkdoc-current-buffer' ends up checking ;; the buffer named "*NOT THE BUFFER TO CHECK*" instead of the buffer ;; named "test-checkdoc-buffer.el". ;;=20 ;; 1. `eval-buffer' will reproduce it interactively. ;;=20 ;; 2. Shell command: ;;=20 ;; emacs -Q --batch --eval=3D'(progn (find-file "./test-checkdoc-buff= er.el") (eval-buffer))' ;;=20=20=20=20=20=20 ;; will reproduce it in a raw emacs. (defun my-bad-documented-function () (let (;; The buffer we would like to check (to-check (get-buffer "test-checkdoc-buffer.el")) ;; The buffer the checkdoc will say is (partly) checked. (bad-buffer (get-buffer-create "*NOT THE BUFFER TO CHECK*")) ) ;; Initialize buffers for successive reproducible tests (switch-to-buffer "*Style Warnings*") (let ((inhibit-read-only t)) (erase-buffer)) (switch-to-buffer bad-buffer) (erase-buffer) (insert "(setq my-bad 2) \n") =20=20=20=20 (switch-to-buffer bad-buffer) ;; Running checkdoc, supposedly on the buffer `to-check'. (save-excursion (with-current-buffer to-check ;; (save-window-excursion (missing-debug-function 'checkdoc-current= -buffer)) ;; (save-window-excursion (missing-debug-function 'checkdoc-comment= s)) (checkdoc-current-buffer :take-notes) )) ;; Testing if we got an warning/error from the `bad-buffer'. (let ((got-bad-buffer-message (save-excursion=20 (switch-to-buffer "*Style Warnings*") (goto-char (point-min)) (search-forward (concat (format "#" bad-buffer) ":1: White space found at end of line") nil :no-error ))) ) (if got-bad-buffer-message (error "ERROR `checkdoc-current-buffer' didn't check the current = buffer") (print "Test ok.")) ))) =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 (my-bad-documented-function) (provide 'test-checkdoc-buffer) ;;; test-checkdoc-buffer.el ends here --=-=-=--