unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: whitespace in comment-start
Date: Sat, 01 May 2021 17:51:55 +0200	[thread overview]
Message-ID: <87v982sb8k.fsf@zoho.eu> (raw)

Check out the 2nd comment block below...

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/latex.el
;;;   https://dataswamp.org/~incal/emacs-init/latex.el

(require 'mode-line)
(require 'super)
(require 'tex-mode)

(defun last-char-of-string (str)
  (string-to-char (substring str -1)) )

;; note creative use of `concat' and `unless' as (concat "a" nil "b") ; "ab"
;; last char comparison so that it'll be "; done" in emacs-lisp, but
;; "<!-- done -->" in markdown (and not "<!--  done -->")
;; however why is the whitespace there in markdown to begin with?

(defun find-here ()
  (interactive)
  (let ((start (point)))
    (goto-char (point-min))
    (let*((sign (concat
                 comment-start
                 (unless (= (last-char-of-string comment-start) ?\  ) " ")
                 "done"
                 comment-end))
          (hits (how-many sign (point-min) (point-max))) )
      (if (> hits 0)
          (progn
            (search-forward-regexp sign)
            (beginning-of-line)
            (recenter 1)
            (message "%d" hits) )
        (goto-char start)
        (insert sign) ))))
(defalias 'h #'find-here)

(defun set-latex-keys ()
  (let ((the-map latex-mode-map))
    (disable-super-global-keys the-map)
    (define-key the-map "\C-c\C-c" #'compile) ))

;; (setq latex-mode-hook nil)
(defun latex-mode-hook-f ()
  (set-latex-keys)
  (auto-fill-mode)
  (abbrev-mode)
  (lines) )
(add-hook 'latex-mode-hook #'latex-mode-hook-f)

-- 
underground experts united
https://dataswamp.org/~incal




                 reply	other threads:[~2021-05-01 15:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v982sb8k.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).