unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* whitespace in comment-start
@ 2021-05-01 15:51 Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-05-01 15:51 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-01 15:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-01 15:51 whitespace in comment-start Emanuel Berg via Users list for the GNU Emacs text editor

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).