Skip to content

Commit

Permalink
Fixes for 7.0.8 test release
Browse files Browse the repository at this point in the history
  • Loading branch information
rswgnu committed Jan 21, 2020
1 parent cac90b5 commit d087a82
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 146 deletions.
15 changes: 15 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

* Published 7.0.8 test release.

* hib-social.el (social-reference): Fixed handling of social refs without any service name,
e.g. #gnu.

* hibtypes.el (action): 'actype::' should be 'actypes::; action variable args were quoted
twice so did not work.

* hpath.el: Fixed to handle in-file HTML-like link references.
(hpath:is-p): Allowed for URL "file://" prefix.
(hpath:markup-link-anchor-regexp): Allowed for anchor only paths, no pathname.
(hpath:find): Use buffer-file-name if pathname is empty.
(hpath:to-markup-anchor): Prevent string-match error if buffer-file-name is null.
hbut.el (hbut:outside-comment-p): Ignore comment status for html-like markup
modes that register as programming modes. This fixes ibuttons not being
recognized, notably in-file anchor links.

* Makefile (ftp): Added missing gzipped tar file dependency
hui-select.el: Removed kotl-mode require as it caused an infinite loading cycle

Expand Down
266 changes: 133 additions & 133 deletions hargs.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,22 @@
(sit-for 1)
nil)))
(save-excursion
(if (not (memq (char-syntax (preceding-char)) '(?w ?_)))
(while (not (looking-at "\\sw\\|\\s_\\|\\'"))
(forward-char 1)))
(unless (memq (char-syntax (preceding-char)) '(?w ?_))
(while (not (looking-at "\\sw\\|\\s_\\|\\'"))
(forward-char 1)))
(while (looking-at "\\sw\\|\\s_")
(forward-char 1))
(if (re-search-backward "\\sw\\|\\s_" nil t)
(regexp-quote
(progn (forward-char 1)
(buffer-substring (point)
(progn (forward-sexp -1)
(while (looking-at "\\s'")
(forward-char 1))
(point)))))
nil)))))
(when (re-search-backward "\\sw\\|\\s_" nil t)
(forward-char 1)
(regexp-quote (buffer-substring (point)
(progn (forward-sexp -1)
(while (looking-at "\\s'")
(forward-char 1))
(point)))))))))

(unless (fboundp 'find-tag--default)
(defun find-tag--default ()
(funcall (or (if (fboundp find-tag-default-function) find-tag-default-function)
(funcall (or (when (fboundp find-tag-default-function) find-tag-default-function)
(get major-mode 'find-tag-default-function)
'find-tag-default))))
(defalias 'hargs:find-tag-default 'find-tag--default)
Expand All @@ -86,9 +84,9 @@ Return nil if ACTION is not a list or `byte-code' object, has no
interactive form or takes no arguments."
(and (or (hypb:emacs-byte-code-p action) (listp action))
(let ((interactive-form (action:commandp action)))
(if interactive-form
(action:path-args-rel
(hargs:iform-read interactive-form modifying))))))
(when interactive-form
(action:path-args-rel
(hargs:iform-read interactive-form modifying))))))

(defun hargs:buffer-substring (start end)
(let ((string (buffer-substring-no-properties start end)))
Expand Down Expand Up @@ -185,8 +183,8 @@ element of the list is always the symbol 'args."
((eq (aref interactive-entry 0) ?+)
(setq cmd (aref interactive-entry 1)
prompt (format (substring interactive-entry 2) prior-arg)
func (if (< cmd (length hargs:iform-extensions-vector))
(aref hargs:iform-extensions-vector cmd)))
func (when (< cmd (length hargs:iform-extensions-vector))
(aref hargs:iform-extensions-vector cmd)))
(if func
(funcall func prompt default)
(error
Expand All @@ -196,8 +194,8 @@ element of the list is always the symbol 'args."
(t (setq cmd (aref interactive-entry 0)
prompt
(format (substring interactive-entry 1) prior-arg)
func (if (< cmd (length hargs:iform-vector))
(aref hargs:iform-vector cmd)))
func (when (< cmd (length hargs:iform-vector))
(aref hargs:iform-vector cmd)))
(if func
(funcall func prompt default)
(error
Expand Down Expand Up @@ -242,8 +240,8 @@ Optional DEFAULT-PROMPT is used to describe default value."
(save-window-excursion
(set-buffer (window-buffer (minibuffer-window)))
(setq hargs:string-to-complete (minibuffer-contents-no-properties))
(if (equal hargs:string-to-complete "")
(setq hargs:string-to-complete nil))))
(when (equal hargs:string-to-complete "")
(setq hargs:string-to-complete nil))))

(defun hargs:unset-string-to-complete ()
"Remove any value from `hargs:string-to-complete'."
Expand Down Expand Up @@ -304,7 +302,7 @@ Handles all of the interactive argument types that `hargs:iform-read' does."
(list (hargs:at-p)))))
((eq hargs:reading-p 'kvspec)
(read-string "Koutline view spec: "
(if (boundp 'kvspec:current) kvspec:current)))
(when (boundp 'kvspec:current) kvspec:current)))
((eolp) nil)
((and (eq hargs:reading-p 'hmenu)
(eq (selected-window) (minibuffer-window)))
Expand Down Expand Up @@ -339,7 +337,7 @@ Handles all of the interactive argument types that `hargs:iform-read' does."
;; Unquoted remote file name.
((hpath:is-p (hpath:remote-at-p) 'file))
;; Possibly non-existent file name
((if no-default (hpath:at-p 'file 'non-exist)))
((when no-default (hpath:at-p 'file 'non-exist)))
(no-default nil)
((buffer-file-name))
))
Expand All @@ -357,7 +355,7 @@ Handles all of the interactive argument types that `hargs:iform-read' does."
;; Unquoted remote directory name.
((hpath:is-p (hpath:remote-at-p) 'directory))
;; Possibly non-existent directory name
((if no-default (hpath:at-p 'directory 'non-exist)))
((when no-default (hpath:at-p 'directory 'non-exist)))
(no-default nil)
(default-directory)
))
Expand All @@ -375,26 +373,26 @@ Handles all of the interactive argument types that `hargs:iform-read' does."
(car (set:member name (htype:names 'ibtypes)))))
((eq hargs:reading-p 'sexpression) (hargs:sexpression-p))
((memq hargs:reading-p '(Info-index-item Info-node))
(if (eq major-mode 'Info-mode)
(let ((file (Info-current-filename-sans-extension))
(node (cond ((Info-note-at-p))
((Info-menu-item-at-p)
(save-excursion
(beginning-of-line)
(forward-char 2)
(Info-extract-menu-node-name nil (Info-index-node))))
(t Info-current-node))))
(cond ((and (stringp node) (string-match "\\`\(" node))
node)
(file
(concat "(" file ")" node))
(t node)))))
(when (eq major-mode 'Info-mode)
(let ((file (Info-current-filename-sans-extension))
(node (cond ((Info-note-at-p))
((Info-menu-item-at-p)
(save-excursion
(beginning-of-line)
(forward-char 2)
(Info-extract-menu-node-name nil (Info-index-node))))
(t Info-current-node))))
(cond ((and (stringp node) (string-match "\\`\(" node))
node)
(file
(concat "(" file ")" node))
(t node)))))
((eq hargs:reading-p 'mail)
(and (hmail:reader-p) buffer-file-name
(prin1-to-string (list (rmail:msg-id-get) buffer-file-name))))
((eq hargs:reading-p 'symbol)
(let ((sym (hargs:find-tag-default)))
(if (or (fboundp sym) (boundp sym)) sym)))
(when (or (fboundp sym) (boundp sym)) sym)))
((eq hargs:reading-p 'buffer)
(hargs:find-tag-default))
((eq hargs:reading-p 'character)
Expand All @@ -405,76 +403,77 @@ Handles all of the interactive argument types that `hargs:iform-read' does."
(when key-seq (kbd-key:normalize key-seq))))
((eq hargs:reading-p 'integer)
(save-excursion (skip-chars-backward "-0-9")
(if (looking-at "-?[0-9]+")
(read (current-buffer)))))))
(when (looking-at "-?[0-9]+")
(read (current-buffer)))))))

(defun hargs:completion (&optional no-insert)
"If in the completions buffer, return completion at point.
Also insert unless optional NO-INSERT is non-nil.
Insert in minibuffer if active or in other window if minibuffer is inactive."
(interactive '(nil))
(if (or (string-match "[* ]Completions\\*\\'" (buffer-name))
(eq major-mode 'completion-mode))
(let ((opoint (point))
(owind (selected-window)))
(if (re-search-backward "^\\|\t\\| [ \t]" nil t)
(let ((insert-window
(cond ((> (minibuffer-depth) 0)
(minibuffer-window))
((not (eq (selected-window) (next-window nil)))
(next-window nil))))
(bury-completions)
(entry))
(skip-chars-forward " \t")
(if (and insert-window
;; Allow single spaces in the middle of completions
;; since completions always end with either a tab,
;; newline or two whitespace characters.
(looking-at
"[^ \t\n]+\\( [^ \t\n]+\\)*\\( [ \t\n]\\|[\t\n]\\|\\'\\)"))
(progn (setq entry (buffer-substring (match-beginning 0)
(match-beginning 2)))
(select-window insert-window)
(let ((str (or hargs:string-to-complete
(buffer-substring
(point)
(save-excursion (beginning-of-line)
(point))))))
(cond
((and (eq (selected-window) (minibuffer-window)))
(cond ((string-match (concat
(regexp-quote entry)
"\\'")
str)
;; If entry matches tail of minibuffer
;; prefix already, then return minibuffer
;; contents as the entry.
(setq entry str))
;;
((string-match "[~/][^/]*\\'" str)
;; file or directory entry
(setq entry
(concat
(substring
str 0
(1+ (match-beginning 0)))
entry))))
(or no-insert
(if entry (progn (erase-buffer)
(insert entry)))))
;; In buffer, non-minibuffer completion.
;; Only insert entry if last buffer line does
;; not end in entry.
(no-insert)
((or (string-match
(concat (regexp-quote entry) "\\'") str)
(null entry))
(setq bury-completions t))
(t (insert entry))))))
(select-window owind) (goto-char opoint)
(if bury-completions
(progn (bury-buffer nil) (delete-window)))
entry)))))
(when (or (string-match "[* ]Completions\\*\\'" (buffer-name))
(eq major-mode 'completion-mode))
(let ((opoint (point))
(owind (selected-window)))
(when (re-search-backward "^\\|\t\\| [ \t]" nil t)
(let ((insert-window
(cond ((> (minibuffer-depth) 0)
(minibuffer-window))
((not (eq (selected-window) (next-window nil)))
(next-window nil))))
(bury-completions)
(entry))
(skip-chars-forward " \t")
(when (and insert-window
;; Allow single spaces in the middle of completions
;; since completions always end with either a tab,
;; newline or two whitespace characters.
(looking-at
"[^ \t\n]+\\( [^ \t\n]+\\)*\\( [ \t\n]\\|[\t\n]\\|\\'\\)"))
(setq entry (buffer-substring (match-beginning 0)
(match-beginning 2)))
(select-window insert-window)
(let ((str (or hargs:string-to-complete
(buffer-substring
(point)
(save-excursion (beginning-of-line)
(point))))))
(cond
((and (eq (selected-window) (minibuffer-window)))
(cond ((string-match (concat
(regexp-quote entry)
"\\'")
str)
;; If entry matches tail of minibuffer
;; prefix already, then return minibuffer
;; contents as the entry.
(setq entry str))
;;
((string-match "[~/][^/]*\\'" str)
;; file or directory entry
(setq entry
(concat
(substring
str 0
(1+ (match-beginning 0)))
entry))))
(or no-insert
(if entry (progn (erase-buffer)
(insert entry)))))
;; In buffer, non-minibuffer completion.
;; Only insert entry if last buffer line does
;; not end in entry.
(no-insert)
((or (string-match
(concat (regexp-quote entry) "\\'") str)
(null entry))
(setq bury-completions t))
(t (insert entry)))))
(select-window owind) (goto-char opoint)
(when bury-completions
(bury-buffer nil)
(delete-window))
entry)))))

(defun hargs:iform-read (iform &optional modifying)
"Read action arguments according to IFORM, a list with car = 'interactive.
Expand Down Expand Up @@ -594,12 +593,13 @@ string read or nil."
(and predicate (not (funcall predicate val)))))
(if bad-val (setq bad-val nil) (setq default val))
(beep)
(if err (progn (message err) (sit-for 3))))
(when err
(message err)
(sit-for 3)))
val)
(setq hargs:reading-p prev-reading-p)
(select-window owind)
(switch-to-buffer obuf)
)))
(switch-to-buffer obuf))))

(defun hargs:read-match (prompt collection
&optional predicate must-match initial-input val-type)
Expand Down Expand Up @@ -635,32 +635,32 @@ the current minibuffer argument, otherwise, the minibuffer is erased
and value is inserted there.
Optional ASSIST-FLAG non-nil triggers display of Hyperbole menu item
help when appropriate."
(if (and (> (minibuffer-depth) 0) (or value (setq value (hargs:at-p))))
(let ((owind (selected-window)) (back-to)
(str-value (and value (format "%s" value)))
;; This command requires recursive minibuffers.
(enable-recursive-minibuffers t))
(unwind-protect
(progn
(select-window (minibuffer-window))
(set-buffer (window-buffer (minibuffer-window)))
(cond
;;
;; Selecting a menu item
((eq hargs:reading-p 'hmenu)
(if assist-flag (setq hargs:reading-p 'hmenu-help))
(hui:menu-enter str-value))
;;
;; Enter existing value into the minibuffer as the desired parameter.
((string-equal str-value (minibuffer-contents))
(exit-minibuffer))
;;
;; Clear minibuffer and insert value.
(t (delete-minibuffer-contents)
(insert str-value)
(setq back-to t)))
value)
(if back-to (select-window owind))))))
(when (and (> (minibuffer-depth) 0) (or value (setq value (hargs:at-p))))
(let ((owind (selected-window)) (back-to)
(str-value (and value (format "%s" value)))
;; This command requires recursive minibuffers.
(enable-recursive-minibuffers t))
(unwind-protect
(progn
(select-window (minibuffer-window))
(set-buffer (window-buffer (minibuffer-window)))
(cond
;;
;; Selecting a menu item
((eq hargs:reading-p 'hmenu)
(if assist-flag (setq hargs:reading-p 'hmenu-help))
(hui:menu-enter str-value))
;;
;; Enter existing value into the minibuffer as the desired parameter.
((string-equal str-value (minibuffer-contents))
(exit-minibuffer))
;;
;; Clear minibuffer and insert value.
(t (delete-minibuffer-contents)
(insert str-value)
(setq back-to t)))
value)
(when back-to (select-window owind))))))

;;; ************************************************************************
;;; Private variables
Expand Down
Loading

0 comments on commit d087a82

Please sign in to comment.