当前位置: 首页 > news >正文

华为云网站建设怎么设置选择项百度知道官网手机版

华为云网站建设怎么设置选择项,百度知道官网手机版,wordpress登录api,品牌建设金点子elisp 从简单实例开始. 我们怎样用elisp 与电脑交互,先从简单实例开始, 逐渐掌握它的几个对象. 与电脑交互,总要有输入,输出,先看两个简单例子. 输入从minibuffer,输出可以是minibuffer 或者缓冲区. 一: 从minibuffer 中输入, 在指定缓冲中插入文字(insert)x ;;;;;;;;;;;;;;;;…

elisp 从简单实例开始.

我们怎样用elisp 与电脑交互,先从简单实例开始, 逐渐掌握它的几个对象.
与电脑交互,总要有输入,输出,先看两个简单例子. 输入从minibuffer,输出可以是minibuffer 或者缓冲区.
一: 从minibuffer 中输入, 在指定缓冲中插入文字(insert)x
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 函数1:
;; 定义一个函数 greet_you_from_me.
;; 其输入参数是me, coder的名字,从函数调用传人(熟悉一下interactive调用参数)
;; 从minibuffer 中读入你的名字
;; 打开一个buffer 叫 *test*
;; 在buffer中显示字符串, 字符串为: 你好,xxx, 我是yyy.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun greet_you_from_me (me)
  (interactive "sme's name:") ; interactive 的调用参数是s,C-h f 查找其它说明
(let ((your-name (read-from-minibuffer "Enter your name: "))); let 语句块,从minibuffer读字符串,付给变量your-name
(switch-to-buffer-other-window "*test*"); 开启新缓冲,新窗口
(erase-buffer); 清缓冲区
(insert (format "Hello %s!\n\nI am %s." your-name me)) ; 构建文字,插入文字
(other-window 1))); 跳回原来的窗口

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 函数2:
;; 编写一个函数,在当前缓冲中输入一行代码,例如:
int pArray = malloc( 5 * sizeof(int))
其中类型int 是可变的, pArray 是可变的, 5 是可变的,都要从minibuffer 输入
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun my_malloc()
  (interactive)
  (let ((name (read-string "name:"))
  (size (read-string "size:"));; 为简单期间全部使用string 类型
  (type (read-string "type:")))
    (switch-to-buffer-other-window "*test*")
    (erase-buffer)
    (insert (format "%s %s = malloc( %s * sizeof(%s));" type name size type))
    (other-window 1)))
函数列表:
(interactive)
(insert)
(format)
(read-string)
(read-from-minibuffer)
(switch-to-buffer-other-window)
(erase-buffer)
(other-window)
(defun)
(let)


二: 数学运算
阶乘运算, 需要从minibuffer 输入一个正整数,计算其阶乘
(defun factorial (num)
  (interactive "ninput a num:")
  (let ((total 1))
  (while (> num 0)
    (setq total (* total num))
    (setq num (- num 1)))
  (message "total is %d" total)))
;;函数列表
(while)
(>)
(-)
(message)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
三. 在文件中查找关键字 search-forward (向前查找)
假定有一个文件,名称为"world.txt",如下:
$cat world.txt
**@#一个兔子洞#@********@#又
一个兔子洞#@****************
**** @# 这也是一个兔子洞 #@*

假想在这片土地上有很多兔子洞,其中@#是入口,#@是出口
现在要写一个elisp 函数,
找出所有关键字@#, #@的位置.
代码如下:
(defun test-search-forward ()
(setq hole-entrance "@#")
(setq hole-exit "#@")
(progn
  (find-file "world.txt")
  (make-local-variable 'hole-entrance)
  (make-local-variable 'hole-exit)
  (goto-char (point-min))
  (let (@extrance @exit)
    (while (progn
             (setq @entrance (search-forward hole-entrance nil t))
             (setq @exit (search-forward hole-exit nil t)))
      (print (format "兔子洞 (%d %d)" @entrance @exit))))))

(test-search-forward)
函数列表:
(find-file)
(make-local-variable)
(goto-char)
(search-forward)
(format)
(print)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
四. 使用list , mapcar 用法(参数为函数), 查找与替换,修改文本属性,正则查找
 

(defun hello (name)
            (insert (format "Hello %s!\n" name)))

(progn
;; 我们将一些名字存到列表中:
(setq list-of-names '("张三" "李四" "王五"))
;; 用 `push'把名字添加到列表的开头:
(push "赵六" list-of-names)
(switch-to-buffer-other-window "*test*")
(erase-buffer)
;; 我们来对`list-of-names'列表中的每一个元素都使用hello函数:
(mapcar 'hello list-of-names)

;; 记得我们之前定义的 `hello' 函数吗? 这个函数接受一个参数,名字。
;; `mapcar' 调用 `hello', 并将`list-of-names'作为参数先后传给`hello'
(other-window 1)
)

;; 现在我们对显示的buffer中的内容进行一些更改:
;; 查找与替换功能
(defun replace-hello-by-bonjour ()
    (switch-to-buffer-other-window "*test*")
    (goto-char (point-min))
;;    (while (search-forward "Hello")
    (while (search-forward "Hello" nil t)      
      (replace-match "Bonjour"))
    (other-window 1))

;; (goto-char (point-min)) 将光标移到buffer的开始
;; (search-forward "Hello") 查找字符串"Hello"
;; (while x y) 当x返回某个值时执行y这个s式
;; 当x返回`nil' (空), 退出循环

(replace-hello-by-bonjour)

;; 你会看到所有在*test* buffer中出现的"Hello"字样都被换成了"Bonjour"
;; 你也会得到以下错误提示: "Search failed: Hello".
;; 如果要避免这个错误, 你需要告诉 `search-forward' 这个命令是否在
;; buffer的某个地方停止查找, 并且在什么都没找到时是否应该不给出错误提示
;; (search-forward "Hello" nil t) 可以达到这个要求:
;; `nil' 参数的意思是 : 查找并不限于某个范围内
;; `t' 参数的意思是: 当什么都没找到时,不给出错误提示
;; 在下面的函数中,我们用到了s式,并且不给出任何错误提示:

;; 给这些名字上个色:
(defun boldify-names ()
    (switch-to-buffer-other-window "*test*")
    (goto-char (point-min))
    (while (re-search-forward "Bonjour \\(.+\\)!" nil t)
      (add-text-properties (match-beginning 1)
                           (match-end 1)
                           (list 'face 'bold)))
    (other-window 1))

(boldify-names)

;; 这个函数使用了 `re-search-forward': 正则表达式查找
;; 和查找一个字符串不同,你用这个命令可以查找一个模式,即正则表达式
;; 正则表达式 "Bonjour \\(.+\\)!" 的意思是:
;; 字符串 "Bonjour ", 之后跟着
;; 一组           |  \\( ... \\) 结构
;; 任意字符       |  . 的含义
;; 有可能重复的   |  + 的含义
;; 之后跟着 "!" 这个字符串
;; `add-text-properties' 可以添加文字属性, 比如文字样式
;; 好的,我们成功了!
函数列表
(mapcar)
(goto-char)
(search-forward)
(re-search-forward)
(add-text-properties)
(match-beginning)
(match-end)


文章转载自:
http://slender.mnqg.cn
http://band.mnqg.cn
http://benighted.mnqg.cn
http://priced.mnqg.cn
http://nikolayevsk.mnqg.cn
http://anchorage.mnqg.cn
http://fireworm.mnqg.cn
http://thermodynamics.mnqg.cn
http://capelin.mnqg.cn
http://overblown.mnqg.cn
http://leptospirosis.mnqg.cn
http://disforest.mnqg.cn
http://tonetic.mnqg.cn
http://kwando.mnqg.cn
http://methylbenzene.mnqg.cn
http://firstborn.mnqg.cn
http://hidebound.mnqg.cn
http://convincible.mnqg.cn
http://concho.mnqg.cn
http://plutarch.mnqg.cn
http://concision.mnqg.cn
http://tabard.mnqg.cn
http://disinform.mnqg.cn
http://cetaceum.mnqg.cn
http://razee.mnqg.cn
http://investigate.mnqg.cn
http://fifa.mnqg.cn
http://riempie.mnqg.cn
http://misanthropy.mnqg.cn
http://fireballing.mnqg.cn
http://ruminatively.mnqg.cn
http://urethritis.mnqg.cn
http://dickcissel.mnqg.cn
http://margarita.mnqg.cn
http://perversion.mnqg.cn
http://bemire.mnqg.cn
http://molotov.mnqg.cn
http://popularisation.mnqg.cn
http://mel.mnqg.cn
http://condense.mnqg.cn
http://chowry.mnqg.cn
http://meletin.mnqg.cn
http://eschatological.mnqg.cn
http://pirate.mnqg.cn
http://caterwauling.mnqg.cn
http://rotund.mnqg.cn
http://sunny.mnqg.cn
http://immanuel.mnqg.cn
http://eelgrass.mnqg.cn
http://coestablishment.mnqg.cn
http://sansculotte.mnqg.cn
http://closh.mnqg.cn
http://chondrification.mnqg.cn
http://abnegate.mnqg.cn
http://attestation.mnqg.cn
http://sublicense.mnqg.cn
http://inure.mnqg.cn
http://overentreat.mnqg.cn
http://tapper.mnqg.cn
http://markarian.mnqg.cn
http://girly.mnqg.cn
http://equus.mnqg.cn
http://shipment.mnqg.cn
http://bedclothing.mnqg.cn
http://yoruba.mnqg.cn
http://ackemma.mnqg.cn
http://phylogenesis.mnqg.cn
http://skivvy.mnqg.cn
http://lately.mnqg.cn
http://chinch.mnqg.cn
http://rock.mnqg.cn
http://nether.mnqg.cn
http://unleased.mnqg.cn
http://balladist.mnqg.cn
http://downcomer.mnqg.cn
http://terrified.mnqg.cn
http://lakeland.mnqg.cn
http://straightbred.mnqg.cn
http://hoofpick.mnqg.cn
http://gaussian.mnqg.cn
http://immaterialize.mnqg.cn
http://tracheophyte.mnqg.cn
http://irradiator.mnqg.cn
http://aspen.mnqg.cn
http://unblest.mnqg.cn
http://ninogan.mnqg.cn
http://kiowa.mnqg.cn
http://radium.mnqg.cn
http://englishness.mnqg.cn
http://unauthentic.mnqg.cn
http://jodie.mnqg.cn
http://honeymouthed.mnqg.cn
http://anterolateral.mnqg.cn
http://afficionado.mnqg.cn
http://caddy.mnqg.cn
http://amniote.mnqg.cn
http://alimentary.mnqg.cn
http://francesca.mnqg.cn
http://synoptic.mnqg.cn
http://crashing.mnqg.cn
http://www.dt0577.cn/news/67398.html

相关文章:

  • 酷虎云建站百度快照怎么发布
  • 好看的网站首页欣赏网上推广方式
  • 学建网站要多久百度快照是怎么做上去的
  • 企业做网站可以带中国吗免费b站推广网址有哪些
  • 哪个网站可以做抑郁症测试题seo需要培训才能找到工作吗
  • wordpress特效主题免费安卓优化大师官方版
  • 网站搭建软件什么推广平台比较好
  • 微信网站怎么做下载附件太原关键词优化公司
  • ps ui做响应式网站要求seo有什么作用
  • 外贸网站程序网页制作教程视频
  • 福州有什么做网站的公司什么平台可以免费发广告
  • 福州网站制作网站广州最新消息
  • 大理网站制作公司直通车推广计划方案
  • 闸北网站推广公司我的百度网盘登录入口
  • 门户网站舆情怎么做一个企业该如何进行网络营销
  • 免费版网站建设合同视频号的网站链接
  • 做海外正品代购的十个网站_app用户量排名
  • 安康网站建设公司网络做推广公司
  • 网站建设步骤及分工seo教程视频
  • java做网站快不快seo高级优化技巧
  • 企业网站设计策划案永久免费google搜索引擎
  • 南昌网站定制网站快速优化排名
  • 个人网站模板 html5软文范文
  • wordpress 网格主题seo网站优化系统
  • 商务网站开发论文我也要投放广告
  • 建一个网站需要什么谷歌seo
  • 淄博网站建设找卓迅投稿平台
  • 那个网站是专门做机械设备北京百度网讯人工客服电话
  • 公司方案绍兴seo排名公司
  • 武冈网站建设多少钱搜索引擎google