From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Campbell Barton Newsgroups: gmane.emacs.bugs Subject: bug#43481: 27.1; cc-mode's c-context-line-break fails, inserting a new-line into the previous comment Date: Fri, 18 Sep 2020 09:38:16 +1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20423"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.36.5 To: 43481@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 18 01:39:22 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJ3Un-0005DP-KB for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Sep 2020 01:39:21 +0200 Original-Received: from localhost ([::1]:56946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJ3Um-0001N6-2X for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Sep 2020 19:39:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJ3UU-0001Mn-7M for bug-gnu-emacs@gnu.org; Thu, 17 Sep 2020 19:39:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJ3UT-0004bP-Um for bug-gnu-emacs@gnu.org; Thu, 17 Sep 2020 19:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJ3UT-0006Kc-SP for bug-gnu-emacs@gnu.org; Thu, 17 Sep 2020 19:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Campbell Barton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Sep 2020 23:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43481 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.160038591724305 (code B ref -1); Thu, 17 Sep 2020 23:39:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Sep 2020 23:38:37 +0000 Original-Received: from localhost ([127.0.0.1]:40054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJ3U4-0006Jx-Kp for submit@debbugs.gnu.org; Thu, 17 Sep 2020 19:38:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJ3U2-0006Jo-Nz for submit@debbugs.gnu.org; Thu, 17 Sep 2020 19:38:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJ3Tz-0001L1-6V for bug-gnu-emacs@gnu.org; Thu, 17 Sep 2020 19:38:34 -0400 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:54878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJ3Tr-0004Yh-B9 for bug-gnu-emacs@gnu.org; Thu, 17 Sep 2020 19:38:26 -0400 Original-Received: by mail-pj1-x1035.google.com with SMTP id mm21so2126576pjb.4 for ; Thu, 17 Sep 2020 16:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:user-agent:mime-version :content-transfer-encoding; bh=pPPFkzaeerLPjzJ9pMZTymn4Op7Oe8nB1GCI2Lvbp0w=; b=YxlloJHKQQrQVJx5MLlrV1r8ndYS36KtkBS5/hODcEgyZFN71d0wnMikDwaYlD3RlQ WtFA0Bg90Yj5nsTpHnAecAHiLajoe3XjuKDbwyb2XKRaBeFG+O9W9wEbnqsX7D4WoXUj cRBjKBst8HdZ1WQpRbkPtsfEmMf7Aiown/nuJl+AM3G33rCe9OrIKeFRivRWRN84enxD Oo/yqYM3X0KCitlftzFW9gQl3y9PDvsiaUEwLB+TjYceQ+5S0KAdmmTywCMWNdhc9zT+ /eeMDuGLUsaCmqFUqdlPPzbwpjTNqKIC2dEQ1dTeKL0/6i/4/OSs1UgL5mIp62TZIN8N FYMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:user-agent :mime-version:content-transfer-encoding; bh=pPPFkzaeerLPjzJ9pMZTymn4Op7Oe8nB1GCI2Lvbp0w=; b=l49tLGixSgAEJdHpzo99Dqlx7G/yAkfJRCj6DxlzSBGYk5wpxAKvZozl+GzFjJvPEr DomM9I/2LaI351RztS3NVms3Te2gYIpRK/treRTSyPDG1/FcUMC4GYRGpDVDPAxN3kI2 waDC8jZjej5gZYKXwc/0Hy674JrdsuTMeepNYLD0VrUr+1u0XJh2LnEMBn1AAd1WK9tZ ff9ydquVbSIM1nTKHiCdyuf/ATEmOsfrgU2fo34T6yutwZ0CPpwoRfY5Q2H4bmc7rn7V B0Rncv4Z7JzR99ejF7ioui7Ttgt5OHa67ZJuKRy9FpxPPZuutb5kEDwVaj4Mj3Z7vczB Z7FA== X-Gm-Message-State: AOAM531vOVKpWxAbtlgz4eNBE79dMHzAosCEcX/0DflUiaNTrYL3Zk49 rc8ov0jBL9rRd7D/XYv4IplkYw1TJJR7+w== X-Google-Smtp-Source: ABdhPJzLIWyXMhfNU2lgxLy4xHN25S26MLjsp7KiJzkq8jR2osNMJGbJ/fCtS8rCH7R1ueHXl3YUpg== X-Received: by 2002:a17:902:e9d2:b029:d1:e5e7:be63 with SMTP id 18-20020a170902e9d2b02900d1e5e7be63mr12934296plk.61.1600385900122; Thu, 17 Sep 2020 16:38:20 -0700 (PDT) Original-Received: from austpc ([2402:b801:2844:2100::1]) by smtp.gmail.com with ESMTPSA id z28sm807051pfq.81.2020.09.17.16.38.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 16:38:19 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=ideasman42@gmail.com; helo=mail-pj1-x1035.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188262 Archived-At: Running 'c-context-line-break' sometimes adds the line break to the previous comment, this seems to depend on the internal state since it doesn't happen every time. Tested in 27.1, and current master, this has been an issue for some years IIRC. Take this example C file: ---- BEGIN `example.c` /* * A */ /* * B */ ---- END - Move the cursor the end-of-line above 'A'. - M-x, c-context-line-break ---- `example.c` (with newline above 'A', as expected). /* * * A */ /* * B */ ---- END - Move the cursor the end-of-line above 'B'. - M-x, c-context-line-break ---- `example.c` (there should be newline above 'B', but there is not). /* * * A */ /* * B */ ---- END ---- `example.c` (EXPECTED RESULT) /* * * A */ /* * * B */ ---- END Instead of a newline being added above 'B', a newline is added to the previous comment after A, with no leading character. ---- I looked into the bug and this is caused by 'c-literal-limits' returning an invalid range (where the beginning is correct, but the end is the end of the previous comment, instead of the end of the current comment). Printing 'c-literal-limits' before calling 'c-context-line-break' shows this error, temporarily advising 'c-literal-limits' to return the beginning/end of the comment is a workaround which gives the 'EXPECTED RESULT'. In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-29 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.12009000 System Description: Arch Linux Recent messages: Package cl is deprecated LSP :: foo.c not in project or it is blacklisted. Undo-Fu-Session discarding undo data: file length mismatch Undo [5 times] progn: Beginning of buffer mouse-yank-secondary: No secondary selection scroll-up-command: End of buffer funcall-interactively: End of buffer Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LC_CTYPE: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: C/*l Minor modes in effect: display-fill-column-indicator-mode: t spell-fu-mode: t which-function-mode: t highlight-numbers-mode: t default-text-scale-mode: t global-diff-hl-mode: t diff-hl-mode: t show-paren-mode: t savehist-mode: t mydoxygen-highlight-mode: t gui-clipboard-history-mode: t global-evil-surround-mode: t evil-surround-mode: t shell-dirtrack-mode: t evil-mode: t evil-local-mode: t global-undo-fu-session-mode: t undo-fu-session-mode: t override-global-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-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 Load-path shadows: /home/ideasman42/.config/emacs/elpa/cmake-mode-20190710.1319/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode Features: (shadow sort mail-extr scroll-on-drag emacsbug message format-spec rfc822 mml mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils counsel xdg dired dired-loaddefs swiper ivy delsel ivy-faces ivy-overlay colir undo-fu jka-compr add-log vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs view lsp-svelte lsp-sqls lsp-yaml lsp-xml lsp-vimscript lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-terraform lsp-tex lsp-solargraph lsp-rust lsp-rf lsp-r lsp-purescript lsp-pyls lsp-pwsh lsp-php lsp-perl lsp- ocaml lsp-nim lsp-lua lsp-kotlin lsp-json url url-proxy url-privacy url- expand url-methods url-history url-cookie url-domsuf mailcap lsp-javascript lsp-haxe lsp-groovy lsp-hack lsp-go lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-css lsp-csharp gnutls lsp-crystal lsp-cmake lsp-clojure lsp-clangd dom lsp-bash lsp-angular lsp-ada display-fill-column-indicator spell-fu rainbow-delimiters elisp-autofmt nameless lisp-mnt whitespace lisp-extra-font-lock which-func highlight-numbers parent-mode hideshow default-text-scale diff-hl face-remap vc-hg vc-git vc-dir vc vc-dispatcher diff-mode rst cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs hl-line paren stackexchange-transpose-words stackexchange-imenu-goto stackexchange-c-transpose-args stackexchange-sort-line-in-block stackexchange-scroll-and-clamp stackexchange-scratch-buffer-from-file stackexchange-revert-all-buffers stackexchange-neotree-project-dir-toggle stackexchange-mode-line-visual-bell stackexchange-ispell-word-immediate stackexchange-frame-urgent-hint-set stackexchange-delete-surround-at-point stackexchange-comment-multi-line-toggle stackexchange-backspace-whitespace-to-tab-stop savehist gui-clipboard-history-mode lsp-mode lsp-protocol yasnippet xref project url-util tree-widget wid-edit spinner cl network-stream puny nsm rmc markdown-mode rx color noutline outline lv inline imenu ht filenotify f s ewoc dash-functional dash compile bindat evil-surround evil evil-keybindings evil-integration undo-tree diff evil-maps evil- commands ffap reveal flyspell ispell evil-jumps evil-command-window evil-types evil-search evil-ex shell pcomplete comint ansi-color evil-macros evil-repeat evil-states evil-core advice evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro kmacro undo-fu-session cl-extra help-mode pcase inkpot-theme use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key easy-mmode use-package-core derived finder-inf info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded 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 threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x- toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 649698 493642) (symbols 48 36426 1) (strings 32 254465 6152) (string-bytes 1 5053219) (vectors 16 42495) (vector-slots 8 1252832 32982) (floats 8 261 269) (intervals 56 1250 0) (buffers 1000 13))